Ad
Fundamentals
Logic

And even more by removing the foreach bracket, writing System.IComparable instead of writing "using System" at the beggining and removing the useless "public" before the class declaration

Code
Diff
  • class Math{public static T Max<T>(params T[]p)where T:System.IComparable<T>{foreach(T a in p)p[0]=p[0].CompareTo(a)<0?a:p[0];return p[0];}}
    • using System;public class Math{public static T Max<T>(params T[]p)where T:IComparable<T>{foreach(T a in p){p[0]=p[0].CompareTo(a)<0?a:p[0];}return p[0];}}
    • class Math{public static T Max<T>(params T[]p)where T:System.IComparable<T>{foreach(T a in p)p[0]=p[0].CompareTo(a)<0?a:p[0];return p[0];}}

better lol

Code
Diff
  • public static class Kata 
    {
      public static int SameCase(char a, char b) =>
          !char.IsLetter(a) || !char.IsLetter(b) ? -1 :
          char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    }
    • public static class Kata
    • {
    • public static int SameCase(char a, char b)
    • {
    • if (!char.IsLetter(a) || !char.IsLetter(b))
    • return -1;
    • return char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    • }
    • public static int SameCase(char a, char b) =>
    • !char.IsLetter(a) || !char.IsLetter(b) ? -1 :
    • char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    • }
Mathematics
Arrays
Logic

Binary (or base two) is the counting system computers use to do calculations.

Binary values are written using only two values, contrary to our usual counting system which uses ten values.

Here's the wikipedia on binary numbers: https://en.wikipedia.org/wiki/Binary_number#Binary_counting

Your goal is to write a function that adds too binary numbers together whatever their length is.

using System;
using System.Collections.Generic;

class BinaryCalc
{
  public static IEnumerable<bool> Add(bool[] a, bool[] b)
  {
    const bool I = true;
    const bool O = false;
    
    for (int i = 0; i < a.Length; i++)
    {
      
    }
    
    return new bool[1];
  }
}