style: enable ConstantName in checkstyle (#5139)

Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
This commit is contained in:
marysiuniq
2024-05-02 18:31:37 +02:00
committed by GitHub
parent ede3e4651f
commit 1e2d7e9431
16 changed files with 87 additions and 90 deletions

View File

@ -5,14 +5,14 @@ import java.util.Scanner;
public class LCA {
private static final Scanner scanner = new Scanner(System.in);
private static final Scanner SCANNER = new Scanner(System.in);
public static void main(String[] args) {
// The adjacency list representation of a tree:
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(), e = v - 1;
for (int i = 0; i < v; i++) {
adj.add(new ArrayList<Integer>());
@ -21,8 +21,8 @@ public class LCA {
// Storing the given tree as an adjacency list
int to, from;
for (int i = 0; i < e; i++) {
to = scanner.nextInt();
from = scanner.nextInt();
to = SCANNER.nextInt();
from = SCANNER.nextInt();
adj.get(to).add(from);
adj.get(from).add(to);
@ -38,7 +38,7 @@ public 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(), v2 = SCANNER.nextInt();
// Outputting the LCA
System.out.println(getLCA(v1, v2, depth, parent));