KLA interview question

Questions on array and greedy search