File tree Expand file tree Collapse file tree 1 file changed +0
-4
lines changed
src/main/java/g1401_1500/s1449_form_largest_integer_with_digits_that_add_up_to_target Expand file tree Collapse file tree 1 file changed +0
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ public class Solution {
88 public String largestNumber (int [] cost , int target ) {
99 int [][] dp = new int [10 ][5001 ];
1010 Arrays .fill (dp [0 ], -1 );
11-
1211 for (int i = 1 ; i <= cost .length ; i ++) {
1312 for (int j = 1 ; j <= target ; j ++) {
1413 if (cost [i - 1 ] > j ) {
@@ -24,7 +23,6 @@ public String largestNumber(int[] cost, int target) {
2423 } else {
2524 temp = Math .max (t , temp );
2625 }
27-
2826 if (dp [i - 1 ][j ] == -1 ) {
2927 dp [i ][j ] = temp ;
3028 } else if (temp == -1 ) {
@@ -41,7 +39,6 @@ public String largestNumber(int[] cost, int target) {
4139 int i = 9 ;
4240 StringBuilder result = new StringBuilder ();
4341 while (target > 0 ) {
44-
4542 if ((target - cost [i - 1 ] >= 0 && dp [i ][target - cost [i - 1 ]] + 1 == dp [i ][target ])
4643 || (target - cost [i - 1 ] >= 0
4744 && dp [i - 1 ][target - cost [i - 1 ]] + 1 == dp [i ][target ])) {
@@ -51,7 +48,6 @@ public String largestNumber(int[] cost, int target) {
5148 i --;
5249 }
5350 }
54-
5551 return result .toString ();
5652 }
5753}
You can’t perform that action at this time.
0 commit comments