The Lead Game(Beginner)

import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr1[] = new int[n];
int arr2[] = new int[n];
int arr3[] = new int[n];
int arr4[] = new int[n];
for (int i = 0; i < n; i++) {
arr1[i] = sc.nextInt();
arr2[i] = sc.nextInt();

	}
	for (int i = 0; i < n; i++) {
		if (arr1[i] > arr2[i])
			arr3[i] = arr1[i] - arr2[i];
		else
			arr4[i] = arr2[i] - arr1[i];

	}
	Arrays.sort(arr3);
	Arrays.sort(arr4);

	if (arr3[n - 1] > arr4[n - 1])
		System.out.println(1 + "  " + arr3[n - 1]);
	else
		System.out.println(2 + "  " + arr4[n - 1]);
}

}

input:
5
140 82
89 134
90 110
112 106
88 90
Output:

1 58

Still showing wrong answer

Just post the link of question and your solution, no need to post your code here just share your approach here

Search on forums. Answered already ~10-20 times.

//