Constructing a Number

  • + 0 comments
    static String canConstruct(int[] a) {
            // Return "Yes" or "No" denoting whether you can construct the required number.
            long sum = 0;
            for(int i:a){
                sum+=i;
            }
    
            return sum%3==0? "Yes":"No";
        }