https://onlinegdb.com/0T2MhTZDu

why 2/4 test cases are failing for this code?

hi @hittasehgal,
here’s the upadted code ive commented in detail https://ide.codingblocks.com/s/662095