style: enable MultipleVariableDeclarations
in checkstyle (#5175)
Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
This commit is contained in:
parent
44ce6e7b0d
commit
9eaa2bb756
@ -167,7 +167,7 @@
|
||||
<module name="InnerAssignment"/>
|
||||
<!-- TODO <module name="MagicNumber"/> -->
|
||||
<!-- TODO <module name="MissingSwitchDefault"/> -->
|
||||
<!-- TODO <module name="MultipleVariableDeclarations"/> -->
|
||||
<module name="MultipleVariableDeclarations"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
|
||||
|
@ -8,7 +8,8 @@ package com.thealgorithms.backtracking;
|
||||
*/
|
||||
public class PowerSum {
|
||||
|
||||
private int count = 0, sum = 0;
|
||||
private int count = 0;
|
||||
private int sum = 0;
|
||||
|
||||
public int powSum(int N, int X) {
|
||||
Sum(N, X, 1);
|
||||
|
@ -1175,7 +1175,8 @@ public class Blowfish {
|
||||
|
||||
// round function
|
||||
private String round(int time, String plainText) {
|
||||
String left, right;
|
||||
String left;
|
||||
String right;
|
||||
left = plainText.substring(0, 8);
|
||||
right = plainText.substring(8, 16);
|
||||
left = xor(left, P[time]);
|
||||
|
@ -74,13 +74,15 @@ public class DES {
|
||||
|
||||
private String[] getSubkeys(String originalKey) {
|
||||
StringBuilder permutedKey = new StringBuilder(); // Initial permutation of keys via pc1
|
||||
int i, j;
|
||||
int i;
|
||||
int j;
|
||||
for (i = 0; i < 56; i++) {
|
||||
permutedKey.append(originalKey.charAt(PC1[i] - 1));
|
||||
}
|
||||
String[] subKeys = new String[16];
|
||||
String initialPermutedKey = permutedKey.toString();
|
||||
String C0 = initialPermutedKey.substring(0, 28), D0 = initialPermutedKey.substring(28);
|
||||
String C0 = initialPermutedKey.substring(0, 28);
|
||||
String D0 = initialPermutedKey.substring(28);
|
||||
|
||||
// We will now operate on the left and right halves of the permutedKey
|
||||
for (i = 0; i < 16; i++) {
|
||||
@ -105,7 +107,8 @@ public class DES {
|
||||
}
|
||||
|
||||
private String XOR(String a, String b) {
|
||||
int i, l = a.length();
|
||||
int i;
|
||||
int l = a.length();
|
||||
StringBuilder xor = new StringBuilder();
|
||||
for (i = 0; i < l; i++) {
|
||||
int firstBit = a.charAt(i) - 48; // 48 is '0' in ascii
|
||||
@ -116,7 +119,8 @@ public class DES {
|
||||
}
|
||||
|
||||
private String createPaddedString(String s, int desiredLength, char pad) {
|
||||
int i, l = s.length();
|
||||
int i;
|
||||
int l = s.length();
|
||||
StringBuilder paddedString = new StringBuilder();
|
||||
int diff = desiredLength - l;
|
||||
for (i = 0; i < diff; i++) {
|
||||
@ -165,7 +169,8 @@ public class DES {
|
||||
for (i = 0; i < 64; i++) {
|
||||
permutedMessage.append(message.charAt(IP[i] - 1));
|
||||
}
|
||||
String L0 = permutedMessage.substring(0, 32), R0 = permutedMessage.substring(32);
|
||||
String L0 = permutedMessage.substring(0, 32);
|
||||
String R0 = permutedMessage.substring(32);
|
||||
|
||||
// Iterate 16 times
|
||||
for (i = 0; i < 16; i++) {
|
||||
@ -198,7 +203,9 @@ public class DES {
|
||||
*/
|
||||
public String encrypt(String message) {
|
||||
StringBuilder encryptedMessage = new StringBuilder();
|
||||
int l = message.length(), i, j;
|
||||
int l = message.length();
|
||||
int i;
|
||||
int j;
|
||||
if (l % 8 != 0) {
|
||||
int desiredLength = (l / 8 + 1) * 8;
|
||||
l = desiredLength;
|
||||
@ -223,7 +230,9 @@ public class DES {
|
||||
*/
|
||||
public String decrypt(String message) {
|
||||
StringBuilder decryptedMessage = new StringBuilder();
|
||||
int l = message.length(), i, j;
|
||||
int l = message.length();
|
||||
int i;
|
||||
int j;
|
||||
if (l % 64 != 0) {
|
||||
throw new IllegalArgumentException("Encrypted message should be a multiple of 64 characters in length");
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ public final class HillCipher {
|
||||
System.out.println(messageVector[i][0]);
|
||||
j++;
|
||||
}
|
||||
int x, i;
|
||||
int x;
|
||||
int i;
|
||||
for (i = 0; i < matrixSize; i++) {
|
||||
cipherMatrix[i][0] = 0;
|
||||
|
||||
@ -96,7 +97,8 @@ public final class HillCipher {
|
||||
System.out.println(messageVector[i][0]);
|
||||
j++;
|
||||
}
|
||||
int x, i;
|
||||
int x;
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
plainMatrix[i][0] = 0;
|
||||
|
||||
@ -115,7 +117,10 @@ public final class HillCipher {
|
||||
|
||||
// Determinant calculator
|
||||
public static int determinant(int[][] a, int n) {
|
||||
int det = 0, sign = 1, p = 0, q = 0;
|
||||
int det = 0;
|
||||
int sign = 1;
|
||||
int p = 0;
|
||||
int q = 0;
|
||||
|
||||
if (n == 1) {
|
||||
det = a[0][0];
|
||||
|
@ -27,7 +27,8 @@ public final class AnyBaseToAnyBase {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
String n;
|
||||
int b1, b2;
|
||||
int b1;
|
||||
int b2;
|
||||
while (true) {
|
||||
try {
|
||||
System.out.print("Enter number: ");
|
||||
@ -132,7 +133,8 @@ public final class AnyBaseToAnyBase {
|
||||
// Declare variables: decimal value of n,
|
||||
// character of base b1, character of base b2,
|
||||
// and the string that will be returned.
|
||||
int decimalValue = 0, charB2;
|
||||
int decimalValue = 0;
|
||||
int charB2;
|
||||
char charB1;
|
||||
String output = "";
|
||||
// Go through every character of n
|
||||
|
@ -15,7 +15,9 @@ public final class AnytoAny {
|
||||
int sn = scn.nextInt();
|
||||
int sb = scn.nextInt();
|
||||
int db = scn.nextInt();
|
||||
int m = 1, dec = 0, dn = 0;
|
||||
int m = 1;
|
||||
int dec = 0;
|
||||
int dn = 0;
|
||||
while (sn != 0) {
|
||||
dec = dec + (sn % 10) * m;
|
||||
m *= sb;
|
||||
|
@ -10,7 +10,10 @@ final class BinaryToDecimal {
|
||||
}
|
||||
|
||||
public static long binaryToDecimal(long binNum) {
|
||||
long binCopy, d, s = 0, power = 0;
|
||||
long binCopy;
|
||||
long d;
|
||||
long s = 0;
|
||||
long power = 0;
|
||||
binCopy = binNum;
|
||||
while (binCopy != 0) {
|
||||
d = binCopy % 10;
|
||||
|
@ -32,7 +32,8 @@ public final class BinaryToOctal {
|
||||
*/
|
||||
public static String convertBinaryToOctal(int binary) {
|
||||
String octal = "";
|
||||
int currBit = 0, j = 1;
|
||||
int currBit = 0;
|
||||
int j = 1;
|
||||
while (binary != 0) {
|
||||
int code3 = 0;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
@ -24,7 +24,10 @@ final class DecimalToBinary {
|
||||
* conventional algorithm.
|
||||
*/
|
||||
public static void conventionalConversion() {
|
||||
int n, b = 0, c = 0, d;
|
||||
int n;
|
||||
int b = 0;
|
||||
int c = 0;
|
||||
int d;
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.printf("Conventional conversion.%n Enter the decimal number: ");
|
||||
n = input.nextInt();
|
||||
@ -42,7 +45,10 @@ final class DecimalToBinary {
|
||||
* algorithm
|
||||
*/
|
||||
public static void bitwiseConversion() {
|
||||
int n, b = 0, c = 0, d;
|
||||
int n;
|
||||
int b = 0;
|
||||
int c = 0;
|
||||
int d;
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.printf("Bitwise conversion.%n Enter the decimal number: ");
|
||||
n = input.nextInt();
|
||||
|
@ -18,7 +18,11 @@ public final class DecimalToOctal {
|
||||
// enter in a decimal value to get Octal output
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int n, k, d, s = 0, c = 0;
|
||||
int n;
|
||||
int k;
|
||||
int d;
|
||||
int s = 0;
|
||||
int c = 0;
|
||||
System.out.print("Decimal number: ");
|
||||
n = sc.nextInt();
|
||||
k = n;
|
||||
|
@ -56,7 +56,8 @@ public final class HexToOct {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String hexadecnum;
|
||||
int decnum, octalnum;
|
||||
int decnum;
|
||||
int octalnum;
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
System.out.print("Enter Hexadecimal Number : ");
|
||||
|
@ -11,7 +11,8 @@ class BellmanFord /*
|
||||
*/
|
||||
{
|
||||
|
||||
int vertex, edge;
|
||||
int vertex;
|
||||
int edge;
|
||||
private Edge[] edges;
|
||||
private int index = 0;
|
||||
|
||||
@ -23,7 +24,8 @@ class BellmanFord /*
|
||||
|
||||
class Edge {
|
||||
|
||||
int u, v;
|
||||
int u;
|
||||
int v;
|
||||
int w;
|
||||
|
||||
/**
|
||||
@ -58,7 +60,14 @@ class BellmanFord /*
|
||||
public void go() { // shows distance to all vertices // Interactive run for understanding the
|
||||
try ( // class first time. Assumes source vertex is 0 and
|
||||
Scanner sc = new Scanner(System.in)) {
|
||||
int i, v, e, u, ve, w, j, neg = 0;
|
||||
int i;
|
||||
int v;
|
||||
int e;
|
||||
int u;
|
||||
int ve;
|
||||
int w;
|
||||
int j;
|
||||
int neg = 0;
|
||||
System.out.println("Enter no. of vertices and edges please");
|
||||
v = sc.nextInt();
|
||||
e = sc.nextInt();
|
||||
@ -120,7 +129,11 @@ class BellmanFord /*
|
||||
Edge[] arr) { // be created by using addEdge() method and passed by calling getEdgeArray()
|
||||
// method // Just shows results of computation, if graph is passed to it. The
|
||||
// graph should
|
||||
int i, j, v = vertex, e = edge, neg = 0;
|
||||
int i;
|
||||
int j;
|
||||
int v = vertex;
|
||||
int e = edge;
|
||||
int neg = 0;
|
||||
double[] dist = new double[v]; // Distance array for holding the finalized shortest path
|
||||
// distance between source
|
||||
// and all vertices
|
||||
|
@ -22,7 +22,8 @@ class Graph<E extends Comparable<E>> {
|
||||
|
||||
class Edge {
|
||||
|
||||
Node startNode, endNode;
|
||||
Node startNode;
|
||||
Node endNode;
|
||||
|
||||
Edge(Node startNode, Node endNode) {
|
||||
this.startNode = startNode;
|
||||
@ -46,7 +47,8 @@ class Graph<E extends Comparable<E>> {
|
||||
* @param endNode the ending Node from the edge
|
||||
*/
|
||||
public void addEdge(E startNode, E endNode) {
|
||||
Node start = null, end = null;
|
||||
Node start = null;
|
||||
Node end = null;
|
||||
for (Node node : nodeList) {
|
||||
if (startNode.compareTo(node.name) == 0) {
|
||||
start = node;
|
||||
|
@ -5,7 +5,8 @@ import java.util.Scanner;
|
||||
|
||||
class Cycle {
|
||||
|
||||
private int nodes, edges;
|
||||
private final int nodes;
|
||||
private final int edges;
|
||||
private int[][] adjacencyMatrix;
|
||||
private boolean[] visited;
|
||||
ArrayList<ArrayList<Integer>> cycles = new ArrayList<ArrayList<Integer>>();
|
||||
@ -27,7 +28,8 @@ class Cycle {
|
||||
System.out.println("Enter the details of each edges <Start Node> <End Node>");
|
||||
|
||||
for (int i = 0; i < edges; i++) {
|
||||
int start, end;
|
||||
int start;
|
||||
int end;
|
||||
start = in.nextInt();
|
||||
end = in.nextInt();
|
||||
adjacencyMatrix[start][end] = 1;
|
||||
|
@ -9,7 +9,8 @@ class dijkstras {
|
||||
int k = 9;
|
||||
|
||||
int minDist(int[] dist, Boolean[] Set) {
|
||||
int min = Integer.MAX_VALUE, min_index = -1;
|
||||
int min = Integer.MAX_VALUE;
|
||||
int min_index = -1;
|
||||
|
||||
for (int r = 0; r < k; r++) {
|
||||
if (!Set[r] && dist[r] <= min) {
|
||||
|
@ -75,7 +75,8 @@ class AdjacencyListGraph<E extends Comparable<E>> {
|
||||
* already did
|
||||
*/
|
||||
public boolean addEdge(E from, E to) {
|
||||
Vertex fromV = null, toV = null;
|
||||
Vertex fromV = null;
|
||||
Vertex toV = null;
|
||||
for (Vertex v : vertices) {
|
||||
if (from.compareTo(v.data) == 0) { // see if from vertex already exists
|
||||
fromV = v;
|
||||
|
@ -8,7 +8,8 @@ package com.thealgorithms.datastructures.graphs;
|
||||
*/
|
||||
public class HamiltonianCycle {
|
||||
|
||||
private int V, pathCount;
|
||||
private int V;
|
||||
private int pathCount;
|
||||
private int[] cycle;
|
||||
private int[][] graph;
|
||||
|
||||
|
@ -14,7 +14,8 @@ class PrimMST {
|
||||
// value, from the set of vertices not yet included in MST
|
||||
int minKey(int[] key, Boolean[] mstSet) {
|
||||
// Initialize min value
|
||||
int min = Integer.MAX_VALUE, min_index = -1;
|
||||
int min = Integer.MAX_VALUE;
|
||||
int min_index = -1;
|
||||
|
||||
for (int v = 0; v < V; v++) {
|
||||
if (!mstSet[v] && key[v] < min) {
|
||||
|
@ -66,8 +66,10 @@ public class HashMapCuckooHashing {
|
||||
*/
|
||||
|
||||
public void insertKey2HashTable(int key) {
|
||||
Integer wrappedInt = key, temp;
|
||||
int hash, loopCounter = 0;
|
||||
Integer wrappedInt = key;
|
||||
Integer temp;
|
||||
int hash;
|
||||
int loopCounter = 0;
|
||||
|
||||
if (isFull()) {
|
||||
System.out.println("Hash table is full, lengthening & rehashing table");
|
||||
|
@ -7,7 +7,8 @@ public final class Main {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int choice, key;
|
||||
int choice;
|
||||
int key;
|
||||
|
||||
HashMap h = new HashMap(7);
|
||||
Scanner In = new Scanner(System.in);
|
||||
|
@ -7,7 +7,8 @@ public final class MainCuckooHashing {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int choice, key;
|
||||
int choice;
|
||||
int key;
|
||||
|
||||
HashMapCuckooHashing h = new HashMapCuckooHashing(7);
|
||||
Scanner In = new Scanner(System.in);
|
||||
|
@ -13,9 +13,11 @@ import java.util.ArrayList;
|
||||
*/
|
||||
|
||||
public class LeftistHeap {
|
||||
private final class Node {
|
||||
private int element, npl;
|
||||
private Node left, right;
|
||||
private static final class Node {
|
||||
private final int element;
|
||||
private int npl;
|
||||
private Node left;
|
||||
private Node right;
|
||||
|
||||
// Node constructor setting the data element and left/right pointers to null
|
||||
private Node(int element) {
|
||||
|
@ -82,13 +82,15 @@ public class SinglyLinkedList implements Iterable<Integer> {
|
||||
if (valueFirst == valueSecond) {
|
||||
return;
|
||||
}
|
||||
Node previousA = null, currentA = head;
|
||||
Node previousA = null;
|
||||
Node currentA = head;
|
||||
while (currentA != null && currentA.value != valueFirst) {
|
||||
previousA = currentA;
|
||||
currentA = currentA.next;
|
||||
}
|
||||
|
||||
Node previousB = null, currentB = head;
|
||||
Node previousB = null;
|
||||
Node currentB = head;
|
||||
while (currentB != null && currentB.value != valueSecond) {
|
||||
previousB = currentB;
|
||||
currentB = currentB.next;
|
||||
|
@ -9,7 +9,9 @@ public class AVLTree {
|
||||
private int key;
|
||||
private int balance;
|
||||
private int height;
|
||||
private Node left, right, parent;
|
||||
private Node left;
|
||||
private Node right;
|
||||
private Node parent;
|
||||
|
||||
Node(int k, Node p) {
|
||||
key = k;
|
||||
|
@ -14,14 +14,16 @@ public final class LCA {
|
||||
ArrayList<ArrayList<Integer>> adj = new ArrayList<>();
|
||||
|
||||
// v is the number of vertices and e is the number of edges
|
||||
int v = SCANNER.nextInt(), e = v - 1;
|
||||
int v = SCANNER.nextInt();
|
||||
int e = v - 1;
|
||||
|
||||
for (int i = 0; i < v; i++) {
|
||||
adj.add(new ArrayList<Integer>());
|
||||
}
|
||||
|
||||
// Storing the given tree as an adjacency list
|
||||
int to, from;
|
||||
int to;
|
||||
int from;
|
||||
for (int i = 0; i < e; i++) {
|
||||
to = SCANNER.nextInt();
|
||||
from = SCANNER.nextInt();
|
||||
@ -40,7 +42,8 @@ public final class LCA {
|
||||
dfs(adj, 0, -1, parent, depth);
|
||||
|
||||
// Inputting the two vertices whose LCA is to be calculated
|
||||
int v1 = SCANNER.nextInt(), v2 = SCANNER.nextInt();
|
||||
int v1 = SCANNER.nextInt();
|
||||
int v2 = SCANNER.nextInt();
|
||||
|
||||
// Outputting the LCA
|
||||
System.out.println(getLCA(v1, v2, depth, parent));
|
||||
|
@ -10,10 +10,12 @@ public class LazySegmentTree {
|
||||
*/
|
||||
static class Node {
|
||||
|
||||
private final int start, end; // start and end of the segment represented by this node
|
||||
private final int start;
|
||||
private final int end; // start and end of the segment represented by this node
|
||||
private int value; // value is the sum of all elements in the range [start, end)
|
||||
private int lazy; // lazied value that should be added to children nodes
|
||||
Node left, right; // left and right children
|
||||
Node left;
|
||||
Node right; // left and right children
|
||||
|
||||
Node(int start, int end, int value) {
|
||||
this.start = start;
|
||||
|
@ -10,7 +10,8 @@ class TreeNode {
|
||||
// Members
|
||||
|
||||
int key;
|
||||
TreeNode left, right;
|
||||
TreeNode left;
|
||||
TreeNode right;
|
||||
|
||||
// Constructor
|
||||
TreeNode(int key) {
|
||||
|
@ -12,8 +12,11 @@ public class RedBlackBST {
|
||||
|
||||
private class Node {
|
||||
|
||||
int key = -1, color = B;
|
||||
Node left = nil, right = nil, p = nil;
|
||||
int key = -1;
|
||||
int color = B;
|
||||
Node left = nil;
|
||||
Node right = nil;
|
||||
Node p = nil;
|
||||
|
||||
Node(int key) {
|
||||
this.key = key;
|
||||
|
@ -29,7 +29,8 @@ public class TreeRandomNode {
|
||||
private final class Node {
|
||||
|
||||
int item;
|
||||
Node left, right;
|
||||
Node left;
|
||||
Node right;
|
||||
}
|
||||
|
||||
// Using an arraylist to store the inorder traversal of the given binary tree
|
||||
|
@ -47,7 +47,8 @@ public final class VerticalOrderTraversal {
|
||||
|
||||
/* min and max stores leftmost and right most index to
|
||||
later print the tree in vertical fashion.*/
|
||||
int max = 0, min = 0;
|
||||
int max = 0;
|
||||
int min = 0;
|
||||
queue.offer(root);
|
||||
index.offer(0);
|
||||
|
||||
|
@ -28,7 +28,8 @@ public class BinaryExponentiation {
|
||||
|
||||
// iterative function to calculate a to the power of b
|
||||
long power(long N, long M) {
|
||||
long power = N, sum = 1;
|
||||
long power = N;
|
||||
long sum = 1;
|
||||
while (M > 0) {
|
||||
if ((M & 1) == 1) {
|
||||
sum *= power;
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
@ -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++) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -27,7 +27,8 @@ public class BufferedReader {
|
||||
/**
|
||||
* posRead -> indicates the next byte to read
|
||||
*/
|
||||
private int posRead = 0, bufferPos = 0;
|
||||
private int posRead = 0;
|
||||
private int bufferPos = 0;
|
||||
|
||||
private boolean foundEof = false;
|
||||
|
||||
|
@ -24,7 +24,8 @@ public final class AutomorphicNumber {
|
||||
public static boolean isAutomorphic(long n) {
|
||||
if (n < 0) return false;
|
||||
long square = n * n; // Calculating square of the number
|
||||
long t = n, numberOfdigits = 0;
|
||||
long t = n;
|
||||
long numberOfdigits = 0;
|
||||
while (t > 0) {
|
||||
numberOfdigits++; // Calculating number of digits in n
|
||||
t /= 10;
|
||||
|
@ -13,7 +13,10 @@ public final class DeterminantOfMatrix {
|
||||
// Determinant calculator
|
||||
//@return determinant of the input matrix
|
||||
static int determinant(int[][] a, int n) {
|
||||
int det = 0, sign = 1, p = 0, q = 0;
|
||||
int det = 0;
|
||||
int sign = 1;
|
||||
int p = 0;
|
||||
int q = 0;
|
||||
if (n == 1) {
|
||||
det = a[0][0];
|
||||
} else {
|
||||
|
@ -24,7 +24,8 @@ public final class FFT {
|
||||
*/
|
||||
static class Complex {
|
||||
|
||||
private double real, img;
|
||||
private double real;
|
||||
private double img;
|
||||
|
||||
/**
|
||||
* Default Constructor. Creates the complex number 0.
|
||||
|
@ -41,7 +41,8 @@ public final class FindKthNumber {
|
||||
}
|
||||
|
||||
private static int findKthMax(int[] nums, int k) {
|
||||
int start = 0, end = nums.length;
|
||||
int start = 0;
|
||||
int end = nums.length;
|
||||
while (start < end) {
|
||||
int pivot = partition(nums, start, end);
|
||||
if (k == pivot) {
|
||||
|
@ -8,7 +8,8 @@ public final class Gaussian {
|
||||
|
||||
public static ArrayList<Double> gaussian(int mat_size, ArrayList<Double> matrix) {
|
||||
ArrayList<Double> answerArray = new ArrayList<Double>();
|
||||
int i, j = 0;
|
||||
int i;
|
||||
int j = 0;
|
||||
|
||||
double[][] mat = new double[mat_size + 1][mat_size + 1];
|
||||
double[][] x = new double[mat_size][mat_size + 1];
|
||||
@ -43,7 +44,8 @@ public final class Gaussian {
|
||||
// calculate the x_1, x_2, ... values of the gaussian and save it in an arraylist.
|
||||
public static ArrayList<Double> valueOfGaussian(int mat_size, double[][] x, double[][] mat) {
|
||||
ArrayList<Double> answerArray = new ArrayList<Double>();
|
||||
int i, j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < mat_size; i++) {
|
||||
for (j = 0; j <= mat_size; j++) {
|
||||
|
@ -11,9 +11,10 @@ final class KeithNumber {
|
||||
// user-defined function that checks if the given number is Keith or not
|
||||
static boolean isKeith(int x) {
|
||||
// List stores all the digits of the X
|
||||
ArrayList<Integer> terms = new ArrayList<Integer>();
|
||||
ArrayList<Integer> terms = new ArrayList<>();
|
||||
// n denotes the number of digits
|
||||
int temp = x, n = 0;
|
||||
int temp = x;
|
||||
int n = 0;
|
||||
// executes until the condition becomes false
|
||||
while (temp > 0) {
|
||||
// determines the last digit of the number and add it to the List
|
||||
@ -25,7 +26,8 @@ final class KeithNumber {
|
||||
}
|
||||
// reverse the List
|
||||
Collections.reverse(terms);
|
||||
int next_term = 0, i = n;
|
||||
int next_term = 0;
|
||||
int i = n;
|
||||
// finds next term for the series
|
||||
// loop executes until the condition returns true
|
||||
while (next_term < x) {
|
||||
|
@ -30,7 +30,8 @@ public final class LeastCommonMultiple {
|
||||
* get least common multiple from two number
|
||||
*/
|
||||
public static int lcm(int num1, int num2) {
|
||||
int high, num3;
|
||||
int high;
|
||||
int num3;
|
||||
int cmv = 0;
|
||||
/*
|
||||
* value selection for the numerator
|
||||
|
@ -13,7 +13,8 @@ public final class NonRepeatingElement {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try (Scanner sc = new Scanner(System.in)) {
|
||||
int i, res = 0;
|
||||
int i;
|
||||
int res = 0;
|
||||
System.out.println("Enter the number of elements in the array");
|
||||
int n = sc.nextInt();
|
||||
if ((n & 1) == 1) {
|
||||
@ -42,7 +43,8 @@ public final class NonRepeatingElement {
|
||||
|
||||
// Finding the rightmost set bit
|
||||
res = res & (-res);
|
||||
int num1 = 0, num2 = 0;
|
||||
int num1 = 0;
|
||||
int num2 = 0;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if ((res & arr[i]) > 0) { // Case 1 explained below
|
||||
|
@ -59,7 +59,9 @@ public final class PollardRho {
|
||||
* @throws RuntimeException object if GCD of given number cannot be found
|
||||
*/
|
||||
static int pollardRho(int number) {
|
||||
int x = 2, y = 2, d = 1;
|
||||
int x = 2;
|
||||
int y = 2;
|
||||
int d = 1;
|
||||
while (d == 1) {
|
||||
// tortoise move
|
||||
x = g(x, number);
|
||||
|
@ -56,7 +56,8 @@ public final class PrimeCheck {
|
||||
*/
|
||||
public static boolean fermatPrimeChecking(int n, int iteration) {
|
||||
long a;
|
||||
int up = n - 2, down = 2;
|
||||
int up = n - 2;
|
||||
int down = 2;
|
||||
for (int i = 0; i < iteration; i++) {
|
||||
a = (long) Math.floor(Math.random() * (up - down + 1) + down);
|
||||
if (modPow(a, n - 1, n) != 1) {
|
||||
|
@ -31,7 +31,10 @@ public final class matrixTranspose {
|
||||
* @return Nothing.
|
||||
*/
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int i, j, row, column;
|
||||
int i;
|
||||
int j;
|
||||
int row;
|
||||
int column;
|
||||
System.out.println("Enter the number of rows in the 2D matrix:");
|
||||
|
||||
/*
|
||||
|
@ -113,7 +113,8 @@ public final class BankersAlgorithm {
|
||||
* This is main method of Banker's Algorithm
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int numberOfProcesses, numberOfResources;
|
||||
int numberOfProcesses;
|
||||
int numberOfResources;
|
||||
|
||||
Scanner sc = new Scanner(System.in);
|
||||
|
||||
|
@ -63,7 +63,8 @@ class Graph {
|
||||
*/
|
||||
public static class Edge {
|
||||
|
||||
public final String v1, v2;
|
||||
public final String v1;
|
||||
public final String v2;
|
||||
public final int dist;
|
||||
|
||||
Edge(String v1, String v2, int dist) {
|
||||
@ -198,7 +199,8 @@ class Graph {
|
||||
* Implementation of dijkstra's algorithm using a binary heap.
|
||||
*/
|
||||
private void dijkstra(final NavigableSet<Vertex> q) {
|
||||
Vertex u, v;
|
||||
Vertex u;
|
||||
Vertex v;
|
||||
while (!q.isEmpty()) {
|
||||
// vertex with shortest distance (first iteration will return source)
|
||||
u = q.pollFirst();
|
||||
|
@ -23,7 +23,8 @@ public final class FibbonaciSeries {
|
||||
// Get input from the user
|
||||
Scanner scan = new Scanner(System.in);
|
||||
int n = scan.nextInt();
|
||||
int first = 0, second = 1;
|
||||
int first = 0;
|
||||
int second = 1;
|
||||
scan.close();
|
||||
while (first <= n) {
|
||||
// print first fibo 0 then add second fibo into it while updating second as well
|
||||
|
@ -9,7 +9,8 @@ final class FloydTriangle {
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Enter the number of rows which you want in your Floyd Triangle: ");
|
||||
int r = sc.nextInt(), n = 0;
|
||||
int r = sc.nextInt();
|
||||
int n = 0;
|
||||
sc.close();
|
||||
for (int i = 0; i < r; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
|
@ -21,7 +21,10 @@ public final class GuassLegendre {
|
||||
* l: No of loops to run
|
||||
*/
|
||||
|
||||
double a = 1, b = Math.pow(2, -0.5), t = 0.25, p = 1;
|
||||
double a = 1;
|
||||
double b = Math.pow(2, -0.5);
|
||||
double t = 0.25;
|
||||
double p = 1;
|
||||
for (int i = 0; i < l; ++i) {
|
||||
double[] temp = update(a, b, t, p);
|
||||
a = temp[0];
|
||||
|
@ -178,7 +178,8 @@ public final class KochSnowflake {
|
||||
*/
|
||||
private static class Vector2 {
|
||||
|
||||
double x, y;
|
||||
double x;
|
||||
double y;
|
||||
|
||||
Vector2(double x, double y) {
|
||||
this.x = x;
|
||||
|
@ -7,7 +7,8 @@ final class Krishnamurthy {
|
||||
}
|
||||
|
||||
static int fact(int n) {
|
||||
int i, p = 1;
|
||||
int i;
|
||||
int p = 1;
|
||||
for (i = n; i >= 1; i--) {
|
||||
p = p * i;
|
||||
}
|
||||
@ -16,7 +17,9 @@ final class Krishnamurthy {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int a, b, s = 0;
|
||||
int a;
|
||||
int b;
|
||||
int s = 0;
|
||||
System.out.print("Enter the number : ");
|
||||
a = sc.nextInt();
|
||||
int n = a;
|
||||
|
@ -9,7 +9,10 @@ package com.thealgorithms.others;
|
||||
*/
|
||||
public class LinearCongruentialGenerator {
|
||||
|
||||
private double a, c, m, previousValue;
|
||||
private final double a;
|
||||
private final double c;
|
||||
private final double m;
|
||||
private double previousValue;
|
||||
|
||||
/**
|
||||
* *
|
||||
|
@ -55,7 +55,9 @@ public class MiniMaxAlgorithm {
|
||||
* @return The optimal score for the player that made the first move.
|
||||
*/
|
||||
public int miniMax(int depth, boolean isMaximizer, int index, boolean verbose) {
|
||||
int bestScore, score1, score2;
|
||||
int bestScore;
|
||||
int score1;
|
||||
int score2;
|
||||
|
||||
if (depth == height) { // Leaf node reached.
|
||||
return scores[index];
|
||||
|
@ -5,7 +5,9 @@ import java.util.Scanner;
|
||||
class PageRank {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int nodes, i, j;
|
||||
int nodes;
|
||||
int i;
|
||||
int j;
|
||||
Scanner in = new Scanner(System.in);
|
||||
System.out.print("Enter the Number of WebPages: ");
|
||||
nodes = in.nextInt();
|
||||
|
@ -58,7 +58,8 @@ final class Rotate {
|
||||
}
|
||||
}
|
||||
}
|
||||
int i = 0, k = n - 1;
|
||||
int i = 0;
|
||||
int k = n - 1;
|
||||
while (i < k) {
|
||||
for (int j = 0; j < n; j++) {
|
||||
int temp = a[i][j];
|
||||
|
@ -59,7 +59,8 @@ public class SkylineProblem {
|
||||
}
|
||||
|
||||
public ArrayList<Skyline> mergeSkyline(ArrayList<Skyline> sky1, ArrayList<Skyline> sky2) {
|
||||
int currentH1 = 0, currentH2 = 0;
|
||||
int currentH1 = 0;
|
||||
int currentH2 = 0;
|
||||
ArrayList<Skyline> skyline = new ArrayList<>();
|
||||
int maxH = 0;
|
||||
|
||||
|
@ -24,7 +24,9 @@ public class SJFScheduling {
|
||||
sortByArrivalTime();
|
||||
}
|
||||
protected void sortByArrivalTime() {
|
||||
int size = processes.size(), i, j;
|
||||
int size = processes.size();
|
||||
int i;
|
||||
int j;
|
||||
ProcessDetails temp;
|
||||
for (i = 0; i < size; i++) {
|
||||
for (j = i + 1; j < size - 1; j++) {
|
||||
@ -44,8 +46,12 @@ public class SJFScheduling {
|
||||
public void scheduleProcesses() {
|
||||
ArrayList<ProcessDetails> ready = new ArrayList<>();
|
||||
|
||||
int size = processes.size(), runtime, time = 0;
|
||||
int executed = 0, j, k = 0;
|
||||
int size = processes.size();
|
||||
int runtime;
|
||||
int time = 0;
|
||||
int executed = 0;
|
||||
int j;
|
||||
int k = 0;
|
||||
ProcessDetails running;
|
||||
|
||||
if (size == 0) {
|
||||
@ -85,8 +91,11 @@ public class SJFScheduling {
|
||||
if (ReadyProcesses.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
int i, size = ReadyProcesses.size();
|
||||
int minBurstTime = ReadyProcesses.get(0).getBurstTime(), temp, positionOfShortestJob = 0;
|
||||
int i;
|
||||
int size = ReadyProcesses.size();
|
||||
int minBurstTime = ReadyProcesses.get(0).getBurstTime();
|
||||
int temp;
|
||||
int positionOfShortestJob = 0;
|
||||
|
||||
for (i = 1; i < size; i++) {
|
||||
temp = ReadyProcesses.get(i).getBurstTime();
|
||||
|
@ -31,7 +31,8 @@ public class SRTFScheduling {
|
||||
}
|
||||
|
||||
public void evaluateScheduling() {
|
||||
int time = 0, cr = 0; // cr=current running process, time= units of time
|
||||
int time = 0;
|
||||
int cr = 0; // cr=current running process, time= units of time
|
||||
int n = processes.size();
|
||||
int[] remainingTime = new int[n];
|
||||
|
||||
|
@ -13,13 +13,16 @@ public final class BinarySearch2dArray {
|
||||
}
|
||||
|
||||
static int[] BinarySearch(int[][] arr, int target) {
|
||||
int rowCount = arr.length, colCount = arr[0].length;
|
||||
int rowCount = arr.length;
|
||||
int colCount = arr[0].length;
|
||||
|
||||
if (rowCount == 1) {
|
||||
return binarySearch(arr, target, 0, 0, colCount);
|
||||
}
|
||||
|
||||
int startRow = 0, endRow = rowCount - 1, midCol = colCount / 2;
|
||||
int startRow = 0;
|
||||
int endRow = rowCount - 1;
|
||||
int midCol = colCount / 2;
|
||||
|
||||
while (startRow < endRow - 1) {
|
||||
int midRow = startRow + (endRow - startRow) / 2; // getting the index of middle row
|
||||
|
@ -23,7 +23,8 @@ class InterpolationSearch {
|
||||
*/
|
||||
public int find(int[] array, int key) {
|
||||
// Find indexes of two corners
|
||||
int start = 0, end = (array.length - 1);
|
||||
int start = 0;
|
||||
int end = (array.length - 1);
|
||||
|
||||
// Since array is sorted, an element present
|
||||
// in array must be in range defined by corner
|
||||
|
@ -32,7 +32,10 @@ public final class IterativeBinarySearch implements SearchAlgorithm {
|
||||
*/
|
||||
@Override
|
||||
public <T extends Comparable<T>> int find(T[] array, T key) {
|
||||
int l, r, k, cmp;
|
||||
int l;
|
||||
int r;
|
||||
int k;
|
||||
int cmp;
|
||||
|
||||
l = 0;
|
||||
r = array.length - 1;
|
||||
|
@ -42,7 +42,8 @@ public final class LinearSearchThread {
|
||||
class Searcher extends Thread {
|
||||
|
||||
private final int[] arr;
|
||||
private final int left, right;
|
||||
private final int left;
|
||||
private final int right;
|
||||
private final int x;
|
||||
private boolean found;
|
||||
|
||||
|
@ -57,7 +57,10 @@ public final class SaddlebackSearch {
|
||||
// TODO Auto-generated method stub
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int[][] arr;
|
||||
int i, j, rows = sc.nextInt(), col = sc.nextInt();
|
||||
int i;
|
||||
int j;
|
||||
int rows = sc.nextInt();
|
||||
int col = sc.nextInt();
|
||||
arr = new int[rows][col];
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = 0; j < col; j++) {
|
||||
|
@ -16,7 +16,8 @@ class CocktailShakerSort implements SortAlgorithm {
|
||||
int length = array.length;
|
||||
int left = 0;
|
||||
int right = length - 1;
|
||||
int swappedLeft, swappedRight;
|
||||
int swappedLeft;
|
||||
int swappedRight;
|
||||
while (left < right) {
|
||||
// front
|
||||
swappedRight = 0;
|
||||
|
@ -9,7 +9,8 @@ public final class DNFSort {
|
||||
static void sort012(int[] a, int arr_size) {
|
||||
int low = 0;
|
||||
int high = arr_size - 1;
|
||||
int mid = 0, temp;
|
||||
int mid = 0;
|
||||
int temp;
|
||||
while (mid <= high) {
|
||||
switch (a[mid]) {
|
||||
case 0: {
|
||||
|
@ -25,7 +25,10 @@ public class LinkListSort {
|
||||
switch (ch) {
|
||||
case 1:
|
||||
Task nm = new Task();
|
||||
Node start = null, prev = null, fresh, ptr;
|
||||
Node start = null;
|
||||
Node prev = null;
|
||||
Node fresh;
|
||||
Node ptr;
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
// New nodes are created and values are added
|
||||
fresh = new Node(); // Node class is called
|
||||
@ -50,7 +53,10 @@ public class LinkListSort {
|
||||
// The given array and the expected array is checked if both are same then true
|
||||
// is displayed else false is displayed
|
||||
case 2:
|
||||
Node start1 = null, prev1 = null, fresh1, ptr1;
|
||||
Node start1 = null;
|
||||
Node prev1 = null;
|
||||
Node fresh1;
|
||||
Node ptr1;
|
||||
for (int i1 = 0; i1 < a.length; i1++) {
|
||||
// New nodes are created and values are added
|
||||
fresh1 = new Node(); // New node is created
|
||||
@ -76,7 +82,10 @@ public class LinkListSort {
|
||||
// is displayed else false is displayed
|
||||
case 3:
|
||||
Task2 mm = new Task2();
|
||||
Node start2 = null, prev2 = null, fresh2, ptr2;
|
||||
Node start2 = null;
|
||||
Node prev2 = null;
|
||||
Node fresh2;
|
||||
Node ptr2;
|
||||
for (int i2 = 0; i2 < a.length; i2++) {
|
||||
// New nodes are created and values are added
|
||||
fresh2 = new Node(); // Node class is created
|
||||
@ -182,7 +191,9 @@ class Task {
|
||||
}
|
||||
|
||||
void task1(int[] n, int s, int m, int e) {
|
||||
int i = s, k = 0, j = m + 1;
|
||||
int i = s;
|
||||
int k = 0;
|
||||
int j = m + 1;
|
||||
int[] b = new int[e - s + 1];
|
||||
while (i <= m && j <= e) {
|
||||
if (n[j] >= n[i])
|
||||
|
@ -50,7 +50,8 @@ class MergeSort implements SortAlgorithm {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends Comparable<T>> void merge(T[] arr, int left, int mid, int right) {
|
||||
int i = left, j = mid + 1;
|
||||
int i = left;
|
||||
int j = mid + 1;
|
||||
System.arraycopy(arr, left, aux, left, right + 1 - left);
|
||||
|
||||
for (int k = left; k <= right; k++) {
|
||||
|
@ -31,7 +31,8 @@ class TimSort implements SortAlgorithm {
|
||||
}
|
||||
|
||||
private <T extends Comparable<T>> void merge(T[] a, int lo, int mid, int hi) {
|
||||
int i = lo, j = mid + 1;
|
||||
int i = lo;
|
||||
int j = mid + 1;
|
||||
System.arraycopy(a, lo, aux, lo, hi + 1 - lo);
|
||||
|
||||
for (int k = lo; k <= hi; k++) {
|
||||
|
@ -12,7 +12,8 @@ public final class LargestRectangle {
|
||||
}
|
||||
|
||||
public static String largestRectanglehistogram(int[] heights) {
|
||||
int n = heights.length, maxArea = 0;
|
||||
int n = heights.length;
|
||||
int maxArea = 0;
|
||||
Stack<int[]> st = new Stack<>();
|
||||
for (int i = 0; i < n; i++) {
|
||||
int start = i;
|
||||
|
@ -90,7 +90,8 @@ public final class PostfixToInfix {
|
||||
Stack<String> stack = new Stack<>();
|
||||
StringBuilder valueString = new StringBuilder();
|
||||
|
||||
String operandA, operandB;
|
||||
String operandA;
|
||||
String operandB;
|
||||
char operator;
|
||||
|
||||
for (int index = 0; index < postfix.length(); index++) {
|
||||
|
@ -7,7 +7,9 @@ final class longestNonRepeativeSubstring {
|
||||
}
|
||||
|
||||
public static int lengthOfLongestSubstring(String s) {
|
||||
int max = 0, start = 0, i = 0;
|
||||
int max = 0;
|
||||
int start = 0;
|
||||
int i = 0;
|
||||
HashMap<Character, Integer> map = new HashMap<>();
|
||||
|
||||
while (i < s.length()) {
|
||||
|
@ -6,10 +6,15 @@ final class zigZagPattern {
|
||||
|
||||
public static String encode(String s, int numRows) {
|
||||
if (numRows < 2 || s.length() < numRows) return s;
|
||||
int start = 0, index = 0, height = 1, depth = numRows;
|
||||
int start = 0;
|
||||
int index = 0;
|
||||
int height = 1;
|
||||
int depth = numRows;
|
||||
char[] zigZagedArray = new char[s.length()];
|
||||
while (depth != 0) {
|
||||
int pointer = start, height_space = 2 + ((height - 2) * 2), depth_space = 2 + ((depth - 2) * 2);
|
||||
int pointer = start;
|
||||
int height_space = 2 + ((height - 2) * 2);
|
||||
int depth_space = 2 + ((depth - 2) * 2);
|
||||
boolean bool = true;
|
||||
while (pointer < s.length()) {
|
||||
zigZagedArray[index++] = s.charAt(pointer);
|
||||
|
Loading…
Reference in New Issue
Block a user