Name: additional_5
Owner: Rolling Scopes School
Description: Brackets
Created: 2017-09-25 09:36:54.0
Updated: 2017-09-25 09:36:56.0
Pushed: 2017-09-20 11:31:01.0
Homepage: null
Size: 4
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Implement function check(str, bracketsConfig)
, that for given brackets sequence will return true
if it is correct and false
otherwise
In the second param there is bracketsConfig
- the array of pairs open-closed brackets. Each subarray includes only 2 elements - opening and closing bracket
k('()', [['(', ')']]) // -> true
k('((()))()', [['(', ')']]) // -> true
k('())(', [['(', ')']]) // -> false
k('([{}])', [['(', ')'], ['[', ']'], ['{', '}']]) // -> true
k('[(])', [['(', ')'], ['[', ']']]) // -> false
k('[]()', [['(', ')'], ['[', ']']]) // -> true
k('[]()(', [['(', ')'], ['[', ']']]) // -> false
pecial case: opening and closing bracket can be the same :)
k('||', [['|', '|']]) // -> true
k('|()|', [['(', ')'], ['|', '|']]) // -> true
k('|(|)', [['(', ')'], ['|', '|']]) // -> false
k('|()|(||)||', [['(', ')'], ['|', '|']]) // -> true
Write your code in src/index.js