Questions about multiple valid answers

  • 1


    For the example:

    not a valid Queue order? It seems to follow all the rules and restrictions, unless I'm missing something.


  • 0

    [4,4] obviously disobey the rule.

  • 0

    I agree with you. It seems to me like the solutions to this problem are not unique. What you pasted seems like it obeys the rules outlined in the problem. Could someone explain why solutions are unique?

  • 0

    @fsi206914 Can you explain why [4, 4] disobeys the rule?

    To quote the problem: k is the number of people in front of this person who have a height greater than or equal to h. In the above example k = 4; h = 4 and there are 5 people ahead of [4, 4] with heights greater than or equal to 4. Since 5 > 4 the requirement is satisfied.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.