@@ -46,7 +46,7 @@ public int maxWeightTransformationDPSol(char str1[], int i, int size, int lookup
4646 return lookup [i ];
4747
4848 // If pair is not made, weight gained is 1
49- int res = 1 + max_len (str1 , i +1 , size , lookup );
49+ int res = 1 + maxWeightTransformationDPSol (str1 , i +1 , size , lookup );
5050
5151 // is pair is made
5252 if (i +1 <= size )
@@ -55,13 +55,13 @@ public int maxWeightTransformationDPSol(char str1[], int i, int size, int lookup
5555 // weight gained is 3 after transformation
5656 if (str1 [i ] == str1 [i +1 ])
5757 {
58- res = Math .max (res , 3 + max_len (str1 , i +2 , size , lookup ));
58+ res = Math .max (res , 3 + maxWeightTransformationDPSol (str1 , i +2 , size , lookup ));
5959 }
6060 // if consecutive elements are different
6161 // weight gained is 4
6262 else if (str1 [i ] != str1 [i +1 ])
6363 {
64- res = Math .max (res , 4 + max_len (str1 , i +2 , size , lookup ));
64+ res = Math .max (res , 4 + maxWeightTransformationDPSol (str1 , i +2 , size , lookup ));
6565 }
6666 }
6767 return lookup [i ] = res ;
@@ -87,7 +87,7 @@ public int maxWeightTransformationNoDPSol(char str1[], int i, int size)
8787 return 1 ;
8888
8989 // If pair is not made, weight gained is 1
90- int res = 1 + max_len (str1 , i +1 , size );
90+ int res = 1 + maxWeightTransformationNoDPSol (str1 , i +1 , size );
9191
9292 // is pair is made
9393 if (i +1 <= size )
@@ -96,13 +96,13 @@ public int maxWeightTransformationNoDPSol(char str1[], int i, int size)
9696 // weight gained is 3 after transformation
9797 if (str1 [i ] == str1 [i +1 ])
9898 {
99- res = Math .max (res , 3 + max_len (str1 , i +2 , size ));
99+ res = Math .max (res , 3 + maxWeightTransformationNoDPSol (str1 , i +2 , size ));
100100 }
101101 // if consecutive elements are different
102102 // weight gained is 4
103103 else if (str1 [i ] != str1 [i +1 ])
104104 {
105- res = Math .max (res , 4 + max_len (str1 , i +2 , size ));
105+ res = Math .max (res , 4 + maxWeightTransformationNoDPSol (str1 , i +2 , size ));
106106 }
107107 }
108108
0 commit comments