Soldiers at the Byterland South Border are ordered to stand in line each morning. They always choose their positions randomly to the displeasure of their general. One evening, the soldiers learn that their strict general has secretly recorded their standing positions from that morning, and that he will be checking their positions the next morning to make sure they are exactly the same.
Each soldier only remembers one thing from that morning: the number of people to his left that were taller than him. There are n soldiers, each with a different height between 1 and n, inclusive. Using this information, you must reconstruct the lineup from that morning.
You are given a int[] left, the ith element of which represents the number of taller soldiers to the left of the soldier with height i (where i is a 1-based index). Return a int[] containing the heights of the soldiers from left to right in the lineup. The input is guaranteed to produce a valid and unique output. |