Isn't the answer for Permutations wrong?


  • 1
    M

    The question:

    https://leetcode.com/problems/permutations/

    Reports that the correct results for all permutations of [1, 3, 3] is:

    [[1,3,3],[1,3,3],[3,1,3],[3,3,1],[3,1,3],[3,3,1]]

    However, there are results repeated in that list. As long as 3 and 3 are the same value, we can not list [1,3,3] and [1,3,3]. I believe that the solution required to pass the question is treating these as unique values which they are not.

    Am I perhaps misinterpreting the question?


  • 0
    R

    "A permutation, also called an "arrangement number" or "order," is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with S itself."
    http://mathworld.wolfram.com/Permutation.html

    I think that they are unique values, here what we focus on is the arrangement order of elements corresponding to the original order, not the context of the elements.

    In the next "Permutations II" question, which focus on unique permutations.


Log in to reply
 

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