-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblemData.js
More file actions
38 lines (35 loc) · 1.06 KB
/
problemData.js
File metadata and controls
38 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const problemData = [
{
title: "Hello World Program",
description: "Write a Python program that prints 'Hello, World!'.",
sampleInput: "N/A",
sampleOutput: "Hello, World!",
difficulty: "Easy",
tags: ["Basics", "Python"],
solution: `# Write your Python code here
print("Hello, World!")`
}
,
{
title: "Remove Outermost Parentheses",
description: "Given a valid parentheses string s, remove the outermost parentheses of every primitive valid parentheses string in its decomposition and return the resulting string.",
sampleInput: "(()())(())",
sampleOutput: "()()()",
difficulty: "Medium",
solution:
`def removeOuterParentheses(s):
result = []
balance = 0
for char in s:
if char == '(':
if balance > 0:
result.append(char)
balance += 1
elif char == ')':
balance -= 1
if balance > 0:
result.append(char)
return ''.join(result)
# Example usage print(removeOuterParentheses('(()())(())')) # Output: '()()()'`,
}
];