Shiprocket interview question

Basic DSA puzzles, only pseudocodes