Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input: n = 3 Expected Output: ["((()))","(()())","(())()","()(())","()()()"]
It flags the output ["()()()","()(())","(())()","(()())","((()))"] as incorrect. The order of the generated parantheses should not matter.
["()()()","()(())","(())()","(()())","((()))"]
For reference, this was the code (in Java) that generated the failed test case:
class Solution { public List<String> generateParenthesis(int n) { List<String> parantheses = new ArrayList<>(); helper(n, n, "", parantheses); return parantheses; } public void helper(int numOpenRemaining, int numCloseRemaining, String p, List<String> parantheses) { if (numOpenRemaining == 0 && numCloseRemaining == 0) { parantheses.add(p); return; } if (numOpenRemaining < numCloseRemaining) { helper(numOpenRemaining, numCloseRemaining - 1, p + ")", parantheses); } if (numOpenRemaining > 0) { helper(numOpenRemaining - 1, numCloseRemaining, p + "(", parantheses); } } }
The text was updated successfully, but these errors were encountered:
Hi, I am working on a team project in school and wanted to take a shot at this issue with my team, can I be allowed permission for this issue?
Sorry, something went wrong.
Thanks for the feedback! The issue has been resolved now.
No branches or pull requests
It flags the output
["()()()","()(())","(())()","(()())","((()))"]
as incorrect. The order of the generated parantheses should not matter.For reference, this was the code (in Java) that generated the failed test case:
The text was updated successfully, but these errors were encountered: