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.

type SafeStringNumbers() =

    member this.Bind(x, f) =
        match System.Int32.TryParse(x) with 
        | (true, v) -> f v
        | _ -> f 0

    member this.Return(x) =
        x

let safeStringNumbers = new SafeStringNumbers()

let v1 = safeStringNumbers {
    let! a = "1"
    let! b = "2"
    let! c = "3"
    return a + b + c
}

let v2 = safeStringNumbers {
    let! a = "1"
    let! b = "foo"
    let! c = "3"
    return a + b + c
}
let sq = seq {
    yield 1
    yield! seq { 2 .. 6 }
    yield 7
    yield! seq [8; 9; 10]
}

let count = Seq.length sq
let list = List.ofSeq sq
Fundamentals
Arrays

Given an array of numbers, return the third greatest number in the array.
You will always be given an array of valid numbers with at least three values.

Ex:
thirdGreatest([4,8,1,5,3]) -> 4

function thirdGreatest(arr){
  return arr.sort( (a,b) => a - b)[arr.length-3]
}
Code
Diff
  • function middleCharacter(str) {
      return str.slice(str.length/2 - !(str.length % 2), str.length/2+1);
    };
  • 11
    function middleCharacter(str) {
    
    2
     if (str.length % 2 !== 0) {
    
    3
      return str.slice(str.length/2, str.length/2+1);
    
    4
    };
    
    5
      return str.slice(str.length/2-1, str.length/2+1);
    
    2+
      return str.slice(str.length/2 - !(str.length % 2), str.length/2+1);
    
    66
    };
    

Recent Moves:

Code
Diff
  • function numSum(num){
      return (num * (num + 1)) / 2;
    }
  • 11
    function numSum(num){
    
    2
      var sum = 0;
    
    3
      for (var i = 1; i <= num; i++) {
    
    4
       sum += i
    
    5
      }
    
    6
      return sum
    
    2+
      return (num * (num + 1)) / 2;
    
    77
    }
    

Recent Moves:

Fundamentals
Strings

You will be given a number of minutes. Your task is to return a string that formats the number into 'hours:minutes". Make sure you always return two intigers for the minutes section of the conversion.
ie ('0:01' instead of '0:1')

Example:

minutes(90) => '1:30'

function minutes(num){
  return num % 60 < 10 ? Math.floor(num/60) + ':' + '0' + (num % 60) : Math.floor(num/60) + ':' + (num % 60)
}

Find the longest word in a given string.
Assume all strings will contain only letters and spaces.

function longestString(str){
  return str.split(' ').sort(function(a,b) { 
   return b.length - a.length
  })[0]
}