Skip to content

Commit d32aabb

Browse files
refactor 241
1 parent a073e9d commit d32aabb

File tree

1 file changed

+0
-25
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-25
lines changed

src/main/java/com/fishercoder/solutions/_241.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,6 @@
33
import java.util.LinkedList;
44
import java.util.List;
55

6-
/**
7-
* 241. Different Ways to Add Parentheses
8-
*
9-
* Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.
10-
11-
12-
Example 1
13-
Input: "2-1-1".
14-
15-
((2-1)-1) = 0
16-
(2-(1-1)) = 2
17-
Output: [0, 2]
18-
19-
20-
Example 2
21-
Input: "2*3-4*5"
22-
23-
(2*(3-(4*5))) = -34
24-
((2*3)-(4*5)) = -14
25-
((2*(3-4))*5) = -10
26-
(2*((3-4)*5)) = -10
27-
(((2*3)-4)*5) = 10
28-
Output: [-34, -14, -10, -10, 10]
29-
30-
*/
316
public class _241 {
327
public static class Solution1 {
338
/**Time: O(n * 4^n / n^(3/2)) ~= n * Catalan numbers = n * (C(2n, n) - C(2n, n - 1)),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy