Krishworks interview question

hour-glass-pattern question. First half and second half.