Begin a new Kumite
Search
About
  • Filter by Language:
  • Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

    You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

    A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

Fundamentals

Very simple, given a number, find its opposite.

Examples:

1: -1
14: -14
-34: 34

using System;

public class Kata
    {
        public  static int Opposite(int number)
        {
            // Happy Coding
            return number*-1;
        }
    }
Algorithms
Mathematics
Numbers

Add second unit test, remove unnecessary assignments, and improve readability.

Code
Diff
  •  using System;
     using System.Linq;
    public class RussianExam
      {
            public static int[] ExamTask(int[] array)
            {
                var multiplesOfThreeCount = array.Where(y => y % 3 == 0).Count();
                return array.Select(x => IsOddMultipleOfThree(x) ? multiplesOfThreeCount : x).ToArray();
            }
      
            private static bool IsOddMultipleOfThree(int x)
            {
              return x % 3 == 0 && x % 2 != 0;
            }
      }
    
  • 11
     using System;
    
    22
     using System.Linq;
    
    33
    public class RussianExam
    
    44
      {
    
    55
            public static int[] ExamTask(int[] array)
    
    66
            {
    
    7
                return array.Select(x => x % 3 == 0 && x % 2 != 0 ? (x = array.Where(y => y % 3 == 0).Count()) : x=x).ToArray();
    
    7+
                var multiplesOfThreeCount = array.Where(y => y % 3 == 0).Count();
    
    8+
                return array.Select(x => IsOddMultipleOfThree(x) ? multiplesOfThreeCount : x).ToArray();
    
    9+
            }
    
    10+
      
    
    11+
            private static bool IsOddMultipleOfThree(int x)
    
    12+
            {
    
    13+
              return x % 3 == 0 && x % 2 != 0;
    
    88
            }
    
    99
      }
    

Recent Moves:

Code
Diff
  • reverse_compliment = lambda dna: dna.translate(dna.maketrans("ACGTacgt", "TGCATGCA"))[::-1]
  • 1
    def reverse_compliment(dna):
    
    2
        # ensure input is in upper case so replace works correctly
    
    3
        uppercase_dna = dna.upper()
    
    4
        # chain compliment replacements, convert to upper case & reverse return value
    
    5
        return (
    
    6
            uppercase_dna.replace("T", "a")
    
    7
            .replace("A", "t")
    
    8
            .replace("C", "g")
    
    9
            .replace("G", "c")
    
    10
            .upper()[::-1]
    
    11
        )
    
    1+
    reverse_compliment = lambda dna: dna.translate(dna.maketrans("ACGTacgt", "TGCATGCA"))[::-1]
    

Recent Moves:

Given a number n, it is your job to multiply the n by all the numbers that are below it stopping at 1.
So if n = 3 then the output should be 3 * 2 * 1 = 6

fun fact(n: Int): Int {
    var fact = 1
    var check = n
    while(check > 0) {
        fact *= check
        check--
    }
    return fact
}

Kumite shouldn't count comment markers and comments as lines of code.

Code
Diff
  • // 
  • 1
    console.log("<PASSED::>");
    
    1+
    // 
    

Recent Moves: