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.

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
2 votes
3 answers
1k views

Problem: Stacks can be used to check whether the given expression has balanced symbols. This algorithm is very useful in compilers. Each time the parser reads one character at a time. If the character ...
Sol's user avatar
  • 29
2 votes
1 answer
286 views

I was working on this problem on leetcode Question Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is valid and ...
D_S_X's user avatar
  • 189
2 votes
1 answer
209 views

A follow-up to this question, this post improves on test case issues. To restate problem parameters, a given string S is considered closed if it: Has a matching ...
T145's user avatar
  • 3,159
3 votes
2 answers
238 views

I don't have a formal description for this problem, but here are the parameters: Given a string S check that each opening bracket has a matching closing bracket. ...
T145's user avatar
  • 3,159
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
5 votes
2 answers
5k views

The code works, at least against the unit tests. But I would like input on how to refactor it. Or also maybe a way to do this without using temporary lists? I also have some special checks, like if ...
aldo's user avatar
  • 63
3 votes
1 answer
558 views

Playing on leetcode coding problem: "Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses." I realized that my understanding of Python was ...
curious's user avatar
  • 333
4 votes
2 answers
260 views

The problem I'm solving is a more complex version of pairing up opening and closing brackets. Instead of matching only on ([{}]), I additionally need to match ...
Iterniam's user avatar
  • 198
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
5 votes
2 answers
853 views

Implement a feature for a text editor to find errors in the usage of brackets in the code. Input: sorted(list(zip(a, b)) Output: False Input: ([{}, {}]) Output: True Here's my implementation in ...
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
3 votes
1 answer
144 views

The goal of this problem is to determine if a string with brackets is valid. Below is a summary of the question from careercup. Check if string s is valid based on brackets ...
RockLeeroy's user avatar
1 vote
2 answers
2k views

This is a Leetcode problem - Given a string containing just the characters '(', ')', '{', <...
Justin's user avatar
  • 2,619
4 votes
3 answers
598 views

I have coded a solution to build all valid permutations of parentheses. My code is below. I have a question on my code based on a comment by my PEP8 checker. It said that there was no need to ...
MrJoe's user avatar
  • 2,173

15 30 50 per page
1
2 3 4 5 6