style: enable LocalVariableName in CheckStyle (#5191)

* style: enable LocalVariableName in checkstyle

* Removed minor bug

* Resolved Method Name Bug

* Changed names according to suggestions
This commit is contained in:
S. Utkarsh
2024-05-28 23:59:28 +05:30
committed by GitHub
parent 81cb09b1f8
commit 25d711c5d8
45 changed files with 418 additions and 417 deletions

View File

@ -33,24 +33,24 @@ public final class PalindromicPartitioning {
int i;
int j;
int L; // different looping variables
int subLen; // different looping variables
// Every substring of length 1 is a palindrome
for (i = 0; i < len; i++) {
isPalindrome[i][i] = true;
}
/* L is substring length. Build the solution in bottom up manner by considering all
/* subLen is substring length. Build the solution in bottom up manner by considering all
* substrings of length starting from 2 to n. */
for (L = 2; L <= len; L++) {
// For substring of length L, set different possible starting indexes
for (i = 0; i < len - L + 1; i++) {
j = i + L - 1; // Ending index
// If L is 2, then we just need to
for (subLen = 2; subLen <= len; subLen++) {
// For substring of length subLen, set different possible starting indexes
for (i = 0; i < len - subLen + 1; i++) {
j = i + subLen - 1; // Ending index
// If subLen is 2, then we just need to
// compare two characters. Else need to
// check two corner characters and value
// of P[i+1][j-1]
if (L == 2) {
if (subLen == 2) {
isPalindrome[i][j] = (word.charAt(i) == word.charAt(j));
} else {
isPalindrome[i][j] = (word.charAt(i) == word.charAt(j)) && isPalindrome[i + 1][j - 1];