I was doing 1238B: Kill 'Em All and this was my solution: `/* package codechef; // don't place package name! */
import java.util.*; import java.lang.*; import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int T = sc.nextInt(); for(int t = 0; t<T; t++){ int n = sc.nextInt(); int r = sc.nextInt(); Integer arr[] = new Integer[n]; for(int i = 0; i<n; i++)arr[i] = sc.nextInt(); Arrays.sort(arr); int cnt = 0; for(int i = n — 1; i >= 0; i--){ if(arr[i] — cnt * r <= 0)break; else{ cnt++; while(i > 0 && arr[i — 1] == arr[i])i--; } } out.println(cnt); } out.flush(); } }` However, with the way that I did it, the only difference between my solution and the working one is the while loop at the end that goes through values that are the same in the array. I just don't understand why my while loop gets an error while Dukkha's doesn't(has solution that is identical but with a different while loop a the end). Dukkha's Solution: 62167923 Thanks!