We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
๐ฌย ๋ฌธ์
https://app.codility.com/programmers/lessons/7-stacks_and_queues/brackets/
๐ฌย Idea
๐ฌย ํ์ด
public func solution(S : inout String) -> Int { let pairBracket: [Character: Character] = ["}": "{", ")": "(", "]": "["] var stack: [Character] = [] for s in S { switch s { case "}", "]", ")": let lastChar = stack.popLast() if lastChar != pairBracket[s] { return 0 } default: stack.append(s) } } return stack.isEmpty ? 1 : 0 }
์์์๊ฐ : 15๋ถ
์์์๊ฐ
์๊ฐ ๋ณต์ก๋ : O(N)
์๊ฐ ๋ณต์ก๋
ํ๊ฐํ : https://app.codility.com/demo/results/trainingYVSH9V-MA3/
ํ๊ฐํ
The text was updated successfully, but these errors were encountered:
#146 - Brakets ๋ฌธ์ ํ์ด
4104503
hwangJi-dev
No branches or pull requests
๐ฌย ๋ฌธ์
https://app.codility.com/programmers/lessons/7-stacks_and_queues/brackets/
๐ฌย Idea
๐ฌย ํ์ด
์์์๊ฐ
: 15๋ถ์๊ฐ ๋ณต์ก๋
: O(N)ํ๊ฐํ
: https://app.codility.com/demo/results/trainingYVSH9V-MA3/The text was updated successfully, but these errors were encountered: