Questions tagged [balanced-delimiters]

When delimiters (a character or sequence marking the beginning, end, or boundary of a unit of data) are correctly placed (often in pairs) within a sequence or sequences of data.

Filter by
Sorted by
Tagged with
40
votes
2answers
36k views

Balanced parentheses

Given an expression string exp, write a program to examine whether the pairs and the orders of "{","}","(",")","[","]" are correct in exp. For example,...
3
votes
5answers
4k views

Validate that brackets are balanced

I've done a test for a job (which I failed) and I'd like to know in which ways my code could've been better. Here are the questions and my answers, it's not very long. 1) Make a program that ...
7
votes
1answer
16k views

Checking for balanced brackets in JavaScript

I'm wrote a simple function isBalanced which takes some code and returns true if the brackets in the code are balanced and ...
5
votes
1answer
247 views

Balanced smileys check algorithm (part 3)

This is a follow-up for here, for bug fixes and applied advice. Problem Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to ...
3
votes
2answers
444 views

Balanced smileys check algorithm (part 4)

This is a follow-up for here, for bug fixes and applied advice. Problem Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to ...
2
votes
2answers
459 views

Balanced smileys check algorithm (part 2)

This is a follow-up for here. Problem Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to express himself through ...
8
votes
2answers
6k views

Balance braces method

This is a continuation of this question, at least the first part of that question. I want to check if everything in the new code is right or if there are other way to make it better. Exercise The <...
2
votes
1answer
386 views

Balanced smileys check algorithm

Problem Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to express himself through emoticons, he hates unbalanced ...
4
votes
2answers
137 views

Check whether string of braces, brackets, and parentheses is balanced

The Task is taken from codewars: Write a function that takes a string of braces, and determines if the order of the braces is valid. It should return true if ...
1
vote
2answers
485 views

Minimum number of parentheses to be removed to make a string of parentheses balanced

The task: Given a string of parentheses, write a function to compute the minimum number of parentheses to be removed to make the string valid (i.e. each open parenthesis is eventually closed). ...