Ad
Numbers
Data Types
Integers
Algorithms
Logic
Code
Diff
  • using System;
    using System.Linq;
    
    public class Kumite
    {
      public static int Digits(ulong n)
      {
        //GEEEEEEET DUUUUUUNKED OOOOOOOOOOOOOON
        int theseDigitsShouldREALLYBeCountedImSureOfIt = n
        .ToString()
        .ToCharArray()
        .Select((c,i)=>new{_char = c, ShouldBeCounted = true, index = i})
        .Select((a,i)=>new{charValue = a._char-'0', shouldREALLYbecounted = a.ShouldBeCounted && a.index==i})
        .OrderBy(a=>a.charValue)
        .ToArray()
        .Where(a=>a.shouldREALLYbecounted.ToString()=="True")
        .ToList()
        .ToArray()
        .Length;
        
        
        int thatNameWasTooLong = theseDigitsShouldREALLYBeCountedImSureOfIt;
        int soWasThatOne = thatNameWasTooLong;
        int betterstill = soWasThatOne;
        int thisone = betterstill;
        int _this = thisone;
        int _ = _this;
        return _;
       } 
    }
    • using System;
    • using System.Linq;
    • public class Kumite
    • {
    • // Unrolled div loop
    • public static int Digits(ulong n) => n.ToString().Length;
    • public static int Digits(ulong n)
    • {
    • //GEEEEEEET DUUUUUUNKED OOOOOOOOOOOOOON
    • int theseDigitsShouldREALLYBeCountedImSureOfIt = n
    • .ToString()
    • .ToCharArray()
    • .Select((c,i)=>new{_char = c, ShouldBeCounted = true, index = i})
    • .Select((a,i)=>new{charValue = a._char-'0', shouldREALLYbecounted = a.ShouldBeCounted && a.index==i})
    • .OrderBy(a=>a.charValue)
    • .ToArray()
    • .Where(a=>a.shouldREALLYbecounted.ToString()=="True")
    • .ToList()
    • .ToArray()
    • .Length;
    • int thatNameWasTooLong = theseDigitsShouldREALLYBeCountedImSureOfIt;
    • int soWasThatOne = thatNameWasTooLong;
    • int betterstill = soWasThatOne;
    • int thisone = betterstill;
    • int _this = thisone;
    • int _ = _this;
    • return _;
    • }
    • }