Compare the Triplets

  • + 0 comments

    C#

    You probably don't need the "continue" if you check both ">" and "<" like @fabinvieira did though.

    public static List<int> compareTriplets(List<int> a, List<int> b)
        {
            int scoreA = 0;
            int scoreB = 0;
            
            for(int i = 0; i < a.Count; i++)
            {
                if(a[i] == b[i])
                    continue;
                if(a[i] > b[i])
                    scoreA++;
                else
                    scoreB++;
            }
            
            return new List<int>(){scoreA, scoreB};
        }