Skip to content

Commit 699579f

Browse files
committed
Updated decode ways
1 parent ff836a6 commit 699579f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Medium/DecodeWays.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
*/
2020
class DecodeWays {
2121
public static void main(String[] args) {
22-
System.out.println(numDecodings("1029"));
22+
DecodeWays d = new DecodeWays();
23+
System.out.println(d.numDecodings("1029"));
2324
}
2425

2526
/**
27+
* Optimal, DP
2628
* Reduce space to O(1)
2729
*/
28-
public static int numDecodingsOptimal(String s) {
30+
public int numDecodingsOptimal(String s) {
2931
if (s == null || s.length() == 0) return 0;
3032
int len = s.length();
3133
int prev1 = 1;

0 commit comments

Comments
 (0)