filmov
tv
Codility - Brackets (JavaScript)

Показать описание
Task Description:
A string S consisting of N characters is considered to be properly nested if any of the following conditions is true:
S is empty;
S has the form "(U)" or "[U]" or "{U}" where U is a properly nested string;
S has the form "VW" where V and W are properly nested strings.
For example, the string "{[()()]}" is properly nested but "([)()]" is not.
Write a function:
function solution(S);
that, given a string S consisting of N characters, returns 1 if S is properly nested and 0 otherwise.
For example, given S = "{[()()]}", the function should return 1 and given S = "([)()]", the function should return 0, as explained above.
Write an efficient algorithm for the following assumptions:
N is an integer within the range [0..200,000];
string S consists only of the following characters: "(", "{", "[", "]", "}" and/or ")".
A string S consisting of N characters is considered to be properly nested if any of the following conditions is true:
S is empty;
S has the form "(U)" or "[U]" or "{U}" where U is a properly nested string;
S has the form "VW" where V and W are properly nested strings.
For example, the string "{[()()]}" is properly nested but "([)()]" is not.
Write a function:
function solution(S);
that, given a string S consisting of N characters, returns 1 if S is properly nested and 0 otherwise.
For example, given S = "{[()()]}", the function should return 1 and given S = "([)()]", the function should return 0, as explained above.
Write an efficient algorithm for the following assumptions:
N is an integer within the range [0..200,000];
string S consists only of the following characters: "(", "{", "[", "]", "}" and/or ")".
Codility - Brackets (JavaScript)
Codility Brackets solution
Codility - Nesting (JavaScript)
Code Review: TapeEquilibrium - codility - JavaScript
Codility - MaxProductOfThree (JavaScript)
Lesson 7:1 - Brackets | Stacks and Queues | Codility for Programmers | Java
Codility - MinAvgTwoSlice (JavaScript)
Codility Nesting solution
Codility - FrogJmp (JavaScript)
BinaryGap - Codility - Algorithm Scripting Practice
Codility - Stone Wall (JavaScript)
Codility_ Task Number 1 - Largest Binary Gap with JavaScript
Codility OddOccurrencesInArray
Codility - Triangle (JavaScript)
Codility Passing Cars
Codility - Fish (JavaScript)
Lesson - 6:3 - Sorting | NumberOfDiscIntersections Java Problem Solving Codility for Programmers
Coderbyte Bracket Matcher - JAVA
LeetCode was HARD until I Learned these 15 Patterns
Codility AbsDistinct solution
Codility's MaxCounters Coding Interview - Part 2
Codility - FrogRiverOne (JavaScript)
Codility Lekcja 4.2: FrogRiverOne
MinPerimeterRectangle
Комментарии