• + 8 comments

    I saw your gist you posted. Looks simple, but I came up with something I think is simpler.

    int N = in.nextInt();
    int sum = 0;
    int count = 0;
    
    for(int i=0; i < N; i++){
        sum += in.nextInt();
                
        if (sum % 2 == 1) {
            count += 2;
        }
    }
    
    System.out.println(sum % 2 == 0 ? count : "NO");
    

    I don't like posting solutions but I like this one and the OP already posted a solution ;)