@@ -8,13 +8,13 @@ private LCA() {
88 }
99
1010 public static void main (String [] args ) {
11- Scanner SCANNER = new Scanner (System .in );
11+ Scanner scanner = new Scanner (System .in );
1212
1313 // The adjacency list representation of a tree:
1414 ArrayList <ArrayList <Integer >> adj = new ArrayList <>();
1515
1616 // v is the number of vertices and e is the number of edges
17- int v = SCANNER .nextInt ();
17+ int v = scanner .nextInt ();
1818 int e = v - 1 ;
1919
2020 for (int i = 0 ; i < v ; i ++) {
@@ -25,8 +25,8 @@ public static void main(String[] args) {
2525 int to ;
2626 int from ;
2727 for (int i = 0 ; i < e ; i ++) {
28- to = SCANNER .nextInt ();
29- from = SCANNER .nextInt ();
28+ to = scanner .nextInt ();
29+ from = scanner .nextInt ();
3030
3131 adj .get (to ).add (from );
3232 adj .get (from ).add (to );
@@ -42,8 +42,8 @@ public static void main(String[] args) {
4242 dfs (adj , 0 , -1 , parent , depth );
4343
4444 // Inputting the two vertices whose LCA is to be calculated
45- int v1 = SCANNER .nextInt ();
46- int v2 = SCANNER .nextInt ();
45+ int v1 = scanner .nextInt ();
46+ int v2 = scanner .nextInt ();
4747
4848 // Outputting the LCA
4949 System .out .println (getLCA (v1 , v2 , depth , parent ));
0 commit comments