Remove unnecessary code (#4141)

This commit is contained in:
Saurabh Rahate
2023-04-03 20:05:59 +05:30
committed by GitHub
parent 805f09850c
commit ad72c28d91
64 changed files with 125 additions and 322 deletions

View File

@ -48,27 +48,21 @@ public class PalindromicPartitioning {
if (L == 2) {
isPalindrome[i][j] = (word.charAt(i) == word.charAt(j));
} else {
if (
(word.charAt(i) == word.charAt(j)) &&
isPalindrome[i + 1][j - 1]
) {
isPalindrome[i][j] = true;
} else {
isPalindrome[i][j] = false;
}
isPalindrome[i][j] = (word.charAt(i) == word.charAt(j)) &&
isPalindrome[i + 1][j - 1];
}
}
}
//We find the minimum for each index
for (i = 0; i < len; i++) {
if (isPalindrome[0][i] == true) {
if (isPalindrome[0][i]) {
minCuts[i] = 0;
} else {
minCuts[i] = Integer.MAX_VALUE;
for (j = 0; j < i; j++) {
if (
isPalindrome[j + 1][i] == true &&
isPalindrome[j + 1][i] &&
1 + minCuts[j] < minCuts[i]
) {
minCuts[i] = 1 + minCuts[j];