Company: Flipkart_2nov
Difficulty: medium
Minimum Moves to Restore Robot Order Problem Description The city of Linkedonia is home to a group of autonomous parade robots. There are N robots participating in the parade and each robot is uniquely identified by an integer from 1 to N. At the start of the parade, the N robots line up in a perfectly ordered sequence (robot 1 to robot N from left to right). During the parade rehearsal, a mischievous hacker interfered and issued a series of reordering commands to the robots. The commands come in two forms: Command Type A: A X Y - move robot X in front of robot Y Command Type B: B X Y - move robot X behind robot Y The robots, being obedient machines, followed the commands exactly. Unfortunately, the parade is about to start, and the robots must return to their original positions from 1 to N, but the rehearsal logs only show the final arrangement and the commands that were issued, not the original positions of X. Given two integers N and M, representing the number of robots and the numb