mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
Refactor Code Style (#4151)
This commit is contained in:
@ -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);
|
||||
|
@ -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)");
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user