Skip to content

Commit 723372e

Browse files
authored
Update MinimumCutsForPalindromicPartition.java
1 parent 4606c54 commit 723372e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

DynamicProgramming/MinimumCutsForPalindromicPartition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public int minCutsPlainPartition(String s, boolean isPlain[][]){
3737
//cuts[i] indicates the minimum cuts required in s[0...i] to form palindrome partition
3838
int cuts[] = new int[n];
3939

40-
for(int i=0;i<n;i++){
40+
for(int i=0 ; i < n ; i++){
4141
//check if the current substring is partition --> if it is a palindrome we need 0 cuts
4242
if(isPlain[0][i]) cuts[i] = 0;
4343
else{
@@ -47,7 +47,7 @@ public int minCutsPlainPartition(String s, boolean isPlain[][]){
4747
//since we need to make palindromic partitions, we check if the 2nd substring s[j+1...i] is a palindrome or not
4848
//we are basically CHOOSING A PARTITION(j) WHICH KEEPS THE 2nd SUBSTRING AS IT IS(bacuse it is a palindrome) AND
4949
//DECOMPOSES THE 1ST SUBSTRING INTO SUBPROBLEMS TO FIND MINIMUM CUTS
50-
for(int j=0;j<i;j++){ //j creates the partition
50+
for(int j=0 ; j < i ; j++){ //j creates the partition
5151

5252
//1. Check if 2nd substring is a palindrome
5353
//2. solve the subproblem --> we are using the bottom up appraoch, subproblem is already solved

0 commit comments

Comments
 (0)