Pine Labs Interview Question

few puzzles