// Path: src/main/java/com/other/FirstDuplicate.java
// static int firstDuplicate(int[] a) {
//     boolean[] duplicates = new boolean[(int) (Math.pow(10, 5)+1)];
//     int i = 0;
//     while(i < a.length && !duplicates[a[i]]){
//         duplicates[a[i++]] = true;
//     }
//     return i < a.length && duplicates[a[i]] ? a[i] : -1;
// }


import org.junit.Test;
import static com.other.FirstDuplicate.firstDuplicate;
import static org.assertj.core.api.Assertions.assertThat;
package com.other;



public class FirstDuplicateTest {

    @Test
    public void failingCase13() {
        int[] a = new int[]{28, 19, 13, 6, 34, 48, 50, 3, 47, 18, 15, 34, 16, 11, 13, 3, 2, 4, 46, 6, 7, 3, 18, 9, 32, 21, 3, 21, 50, 10, 45, 13, 22, 1, 27, 18, 3, 27, 30, 44, 12, 30, 40, 1, 1, 31, 6, 18, 33, 5};
// Path: src/main/java/com/other/FirstDuplicate.java
// static int firstDuplicate(int[] a) {
//     boolean[] duplicates = new boolean[(int) (Math.pow(10, 5)+1)];
//     int i = 0;
//     while(i < a.length && !duplicates[a[i]]){
//         duplicates[a[i++]] = true;
//     }
//     return i < a.length && duplicates[a[i]] ? a[i] : -1;
// }


// Path: src/test/java/com/other/FirstDuplicateTest.java
import org.junit.Test;
import static com.other.FirstDuplicate.firstDuplicate;
import static org.assertj.core.api.Assertions.assertThat;

package com.other;



public class FirstDuplicateTest {

    @Test
    public void failingCase13() {
        int[] a = new int[]{28, 19, 13, 6, 34, 48, 50, 3, 47, 18, 15, 34, 16, 11, 13, 3, 2, 4, 46, 6, 7, 3, 18, 9, 32, 21, 3, 21, 50, 10, 45, 13, 22, 1, 27, 18, 3, 27, 30, 44, 12, 30, 40, 1, 1, 31, 6, 18, 33, 5};
        assertThat(firstDuplicate(a)).isEqualTo(34);