Skip to main content

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.

44 votes
2 answers
40k views

Given an expression string exp, write a program to examine whether the pairs and the orders of "{","}","(",")","[","]" are correct in exp. For example,...
konijn's user avatar
  • 34.4k
30 votes
6 answers
72k views

I'm solving HackerRank "Stacks: Balanced Brackets" in Python. A bracket is considered to be any one of the following characters: (, ...
justapilgrim's user avatar
28 votes
6 answers
28k views

I have refactored one of my old homework assignments (mainly to utilize std::stack and some C++11), and I'm still having trouble making it less repetitive. It ...
Jamal's user avatar
  • 35.2k
22 votes
7 answers
33k views

I was given an assignment to check for balanced parentheses from an arbitrary string where parentheses are defined as (, [ or { and their respective "closing" ...
Overly Excessive's user avatar
10 votes
5 answers
2k views

Objective: Given a string s containing '(', ')', '{', '}', '[', ']' (and other characters), determine if the input string is valid. An input string is valid if: ...
Madagascar's user avatar
  • 10.1k
10 votes
1 answer
3k views

Rules: You should create a function that receives a string with brackets, parentheses, or curly brackets, an example: test('{A}') The function must check that the ...
josmanuel's user avatar
  • 203
9 votes
4 answers
4k views

A recent assignment asks me to create a program that checks for parentheses balance in a given string. As I can't find any duplicate questions that have code written in C, I decided to post another ...
54D's user avatar
  • 257
9 votes
2 answers
2k views

In this program I had to analyse if the parenthesis given are well balanced. For instance, input (()) is correct and input ())(()...
I likeThatMeow's user avatar
9 votes
2 answers
5k views

Here is a small program for checking if the parentheses are balanced or not. I am new to the standard library, and this is my first program. How can I improve it? Any kind of modifications or ...
dsaharia's user avatar
  • 291
8 votes
4 answers
5k views

I'd appreciate feedback on the code itself (style, performance optimization (both space and time)), and also on the algorithm (because I think this is typically implemented using a stack). The ...
jeremy radcliff's user avatar
8 votes
2 answers
8k views

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 <...
Emilio Gort's user avatar
8 votes
1 answer
128 views

This is my code for an assignment. The task is to take a user input in form of a sequence of parenthesis' followed by an E to mark its end and determine whether it is a correct sequence (as an example ...
Ali Bengali's user avatar
7 votes
3 answers
6k views

I wrote a method to check if each parenthesis in a string is closed. It should take into account the order in which a parenthesis is presented, e.g. "hello)goodbye(" should return false even though ...
ThomYorkkke's user avatar
7 votes
2 answers
6k views

So I've been trying to check through a string, looping for, [ (start) and ] (end). In this, I also have to check for nested ...
Ally's user avatar
  • 181
7 votes
4 answers
2k views

I wanted to write a JavaScript function that checked for balanced braces. I'd be grateful for any feedback on correctness and style. ...
52d6c6af's user avatar
  • 672

15 30 50 per page
1
2 3 4 5 6