style: enable MultipleVariableDeclarations in checkstyle (#5175)

Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
This commit is contained in:
vaibhav9t1
2024-05-25 23:48:27 +05:30
committed by GitHub
parent 44ce6e7b0d
commit 9eaa2bb756
82 changed files with 299 additions and 121 deletions

View File

@ -71,7 +71,8 @@ public final class EditDistance {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String s1, s2;
String s1;
String s2;
System.out.println("Enter the First String");
s1 = input.nextLine();
System.out.println("Enter the Second String");

View File

@ -10,7 +10,8 @@ public final class EggDropping {
// min trials with n eggs and m floors
public static int minTrials(int n, int m) {
int[][] eggFloor = new int[n + 1][m + 1];
int result, x;
int result;
int x;
for (int i = 1; i <= n; i++) {
eggFloor[i][0] = 0; // Zero trial for zero floor.
@ -41,7 +42,8 @@ public final class EggDropping {
}
public static void main(String[] args) {
int n = 2, m = 4;
int n = 2;
int m = 4;
// result outputs min no. of trials in worst case for n eggs and m floors
int result = minTrials(n, m);
System.out.println(result);

View File

@ -86,7 +86,9 @@ public final class Fibonacci {
if (n == 0) {
return 0;
}
int prev = 0, res = 1, next;
int prev = 0;
int res = 1;
int next;
for (int i = 2; i <= n; i++) {
next = prev + res;
prev = res;

View File

@ -11,7 +11,8 @@ public final class FordFulkerson {
static final int INF = 987654321;
// edges
static int vertexCount;
static int[][] capacity, flow;
static int[][] capacity;
static int[][] flow;
public static void main(String[] args) {
System.out.println("Vertex Count : 6");

View File

@ -11,7 +11,8 @@ public final class KadaneAlgorithm {
}
public static boolean max_Sum(int[] a, int predicted_answer) {
int sum = a[0], running_sum = 0;
int sum = a[0];
int running_sum = 0;
for (int k : a) {
running_sum = running_sum + k;
// running sum of all the indexs are stored

View File

@ -41,7 +41,8 @@ final class LongestCommonSubsequence {
public static String lcsString(String str1, String str2, int[][] lcsMatrix) {
StringBuilder lcs = new StringBuilder();
int i = str1.length(), j = str2.length();
int i = str1.length();
int j = str2.length();
while (i > 0 && j > 0) {
if (str1.charAt(i - 1) == str2.charAt(j - 1)) {
lcs.append(str1.charAt(i - 1));

View File

@ -23,7 +23,8 @@ public final class LongestPalindromicSubstring {
return input;
}
boolean[][] arr = new boolean[input.length()][input.length()];
int start = 0, end = 0;
int start = 0;
int end = 0;
for (int g = 0; g < input.length(); g++) {
for (int i = 0, j = g; j < input.length(); i++, j++) {
if (g == 0) {

View File

@ -31,7 +31,9 @@ public final class PalindromicPartitioning {
int[] minCuts = new int[len];
boolean[][] isPalindrome = new boolean[len][len];
int i, j, L; // different looping variables
int i;
int j;
int L; // different looping variables
// Every substring of length 1 is a palindrome
for (i = 0; i < len; i++) {

View File

@ -23,7 +23,8 @@ final class ShortestSuperSequence {
// for X[0..m - 1], Y[0..n - 1]
static int lcs(String X, String Y, int m, int n) {
int[][] L = new int[m + 1][n + 1];
int i, j;
int i;
int j;
// Following steps build L[m + 1][n + 1]
// in bottom up fashion. Note that

View File

@ -18,7 +18,9 @@ public final class Tribonacci {
if (n == 0) return 0;
if (n == 1 || n == 2) return 1;
int first = 0, second = 1, third = 1;
int first = 0;
int second = 1;
int third = 1;
for (int i = 3; i <= n; i++) {
int next = first + second + third;