Refactor Code Style (#4151)

This commit is contained in:
Saurabh Rahate
2023-04-15 13:55:54 +05:30
committed by GitHub
parent 1ce907625b
commit 1dc388653a
100 changed files with 293 additions and 319 deletions

View File

@ -39,8 +39,8 @@ public class MaximumMinimumWindow {
*/
public static int[] calculateMaxOfMin(int[] arr, int n) {
Stack<Integer> s = new Stack<>();
int left[] = new int[n + 1];
int right[] = new int[n + 1];
int[] left = new int[n + 1];
int[] right = new int[n + 1];
for (int i = 0; i < n; i++) {
left[i] = -1;
right[i] = n;
@ -74,7 +74,7 @@ public class MaximumMinimumWindow {
s.push(i);
}
int ans[] = new int[n + 1];
int[] ans = new int[n + 1];
for (int i = 0; i <= n; i++) {
ans[i] = 0;
}
@ -96,7 +96,7 @@ public class MaximumMinimumWindow {
return ans;
}
public static void main(String args[]) {
public static void main(String[] args) {
int[] arr = new int[] { 10, 20, 30, 50, 10, 70, 30 };
int[] target = new int[] { 70, 30, 20, 10, 10, 10, 10 };
int[] res = calculateMaxOfMin(arr, arr.length);

View File

@ -118,7 +118,7 @@ public class PostfixToInfix {
return infix;
}
public static void main(String args[]) {
public static void main(String[] args) {
assert getPostfixToInfix("ABC+/").equals("(A/(B+C))");
assert getPostfixToInfix("AB+CD+*").equals("((A+B)*(C+D))");
assert getPostfixToInfix("AB+C+D+").equals("(((A+B)+C)+D)");

View File

@ -10,7 +10,7 @@ import java.util.Stack;
*/
public class ReverseStack {
public static void main(String args[]) {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(
"Enter the number of elements you wish to insert in the stack"