FaceBook Interview question Software Engineer.
Anonymous User
384

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,

Comments (2)