Here is code: https://ide.codingblocks.com/s/250728
Why is wrong in this?
hello @princeky4
ur logic is correct , it is just not printing in required order (i.e print from left to right).
to print in required order first apply ur algorithm without printing anything and then print content of ur map.
refer ur updated code here->