-
Notifications
You must be signed in to change notification settings - Fork 379
Closed
Description
LeetCode Username
endlesscheng
Problem Number, Title, and Link
- Remove K-Balanced Substrings https://leetcode.com/problems/remove-k-balanced-substrings/description/
Bug Category
Missing test case (Incorrect/Inefficient Code getting accepted because of missing test cases)
Bug Description
The following brute-force algorithm passed the worst-case data in 6 seconds.
Language Used for Code
Python/Python3
Code used for Submit/Run operation
class Solution:
def removeSubstring(self, s: str, k: int) -> str:
t = '(' * k + ')' * k
while t in s:
s = s.replace(t, '')
return s
Expected behavior
It is suggested to either increase the constraints or reduce the time limit.
Screenshots

Additional context
Generator:
n = 10 ** 5
s = '(' * (n // 2) + ')' * (n // 2)
k = 1
Metadata
Metadata
Assignees
Labels
No labels