FaceBook Interview question Software Engineer.
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-08-13Added By Anonymous
Source: Link
Company: Meta (Facebook)
Role: Software Engineer
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
Format Idle Machines: We have a cluster with 100 machines (0-99), and a list of taken machines. We want to format the idle machines in a nice, human readable string. Ex. { 2, 3, 9, 12 } -> "0, 1, 4-8, 10, 11, 13-99"
u may use array/list/set
it a sorted list.
if the difference is more than two between the current and previous value display as 4-8,