Ad
  • Custom User Avatar

    Got it, you're right! Thx! 🙏🏻

    However, test cases do not test Unicode, only ASCII.

    "Never do that!" sounds extreme. The intention of Kumite is to challenge and not repeat past solutions.

    This was to similar to the previous 🤷🏻

        public static int SameCase(char a, char b)
        {
            if (!char.IsLetter(a) || !char.IsLetter(b)) return -1;
            return char.ToUpper(a) == char.ToUpper(b) ? 1 : 0;
        }
    
  • Custom User Avatar

    I don't get it! What's wrong with the code? 🤔

  • Custom User Avatar

    You're right, vectorMax should be initialized to that to account for negatives.

    Copying the vectors isn't an issue. You need two vectors to intrinsically compare two vectors. Doing this alone already compensates for the time spent copying some memory around. Memory is cheap. In fact, doing most things in C# involve allocating memory. A foreach loop even creates copies of values.

    From benchmarks I have done a while ago, this method of comparing values in an array is magnitudes faster than any scalar method.