• Skip to primary navigation
  • Skip to content
  • Skip to footer
Xuanken's Space Xuanken's Space
  • About
  • Blog
  • Coding Exercises
  • Projects
    1. Home
    2. /
    3. Exercises
    4. /
    5. Parentheses Grouping
    Xuanken Tay

    Xuanken Tay

    Software engineer who likes statistics, machine learning, DevOps and the cloud

    • Sydney, AU
    • GitHub
    • LinkedIn
    • Email

    Parentheses Grouping

    January 14, 2022 less than 1 minute read

    Given a string s containing balanced parentheses "(" and ")", split them into the maximum number of balanced groups.

    Constraints

    • n ≤ 100,000 where n is length of s.

    https://binarysearch.com/problems/Parentheses-Grouping

    Examples

    Example 1

    Input

    • s = ()()(()())

    Output

    • answer = ['()', '()', '(()())']

    Solution

    Tags: string

    Categories: exercises

    Updated: January 14, 2022

    Share on

    Twitter Facebook LinkedIn
    Previous Next

    Leave a comment

    Read more

    Anagram Substrings

    October 13, 2022 less than 1 minute read

    Given two strings s0 and s1, return the number of substrings where s1 contains any anagram of s0.

    Anagram Partitioning

    September 27, 2022 1 minute read

    You are given two non-empty strings a and b that are the same length. Partition them into substrings such that each pair of a and b’s substring is the same s...

    String Equivalence Relations

    September 25, 2022 2 minute read

    You are given three lowercase alphabet strings a, b and target. Strings a and b have the same length and are defined to be equivalent: a[i] = b[i]. For examp...

    Minimum Window Substring

    August 31, 2022 less than 1 minute read

    Given two lowercase alphabet strings a and b, return the length of a minimum substring in a that contains all the characters of b.

    • Follow:
    • GitHub
    • LinkedIn
    • Feed
    © 2024 Xuanken Tay. Powered by Jekyll & Minimal Mistakes.