public static void main(String[] args) {
        int iterations = 0;
        int result = 0;

        List<Integer> duplicates = new ArrayList<>();
        for (int i = 100; i < 1000; i++) {
            for (int j = 100; j < 1000; j++) {
                if (!duplicates.isEmpty() && i < duplicates.get(duplicates.size() - 1)) break;
                if (duplicates.contains(j)) continue;
                iterations++;
                int palindrome = i * j;
                if (isPalindrome(palindrome)) {
                    duplicates.add(j);
                    if (palindrome > result) {
                        result = palindrome;
                    }
                }
            }
        }
        System.out.println("Result: " + result);
        System.out.println("Iterations: " + iterations);
    }