Same results but different order, can't pass the test.


  • 0
    U

    I solved this problem using recursion. but got different order so cannot pass the test.
    So, why not define the return value to Set?

    Input:
    4

                  Output: 
                  ["(((())))","((()))()","()((()))","((())())","(())()()","()(())()","(()(()))","()(())()","()()(())","((()()))","(()())()","()(()())","(()()())","()()()()"] 
                
    
                
                  Expected: 
                  ["(((())))","((()()))","((())())","((()))()","(()(()))","(()()())","(()())()","(())(())","(())()()","()((()))","()(()())","()(())()","()()(())","()()()()"]

  • 0
    S

    Different order doesn't matter at all. It must miss some particular element.

    Check out this post


Log in to reply
 

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