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.

Mathematics
Algorithms
Numbers
Code
Diff
  • def average(g)
      g==[] ? nil : g.sum.to_f/g.size
    end 
  • 11
    def average(g)
    
    2
      g.size < 1 ? nil : g.reduce(:+).to_f / g.size
    
    2+
      g==[] ? nil : g.sum.to_f/g.size
    
    33
    end 
    
Code
Diff
  • SELECT * FROM pg_database
    WHERE datname IN (SELECT current_database FROM current_catalog)
  • 1
    SELECT * FROM current_catalog LIMIT 1 OFFSET 0
    
    1+
    SELECT * FROM pg_database
    
    2+
    WHERE datname IN (SELECT current_database FROM current_catalog)
    

Recent Moves:

Code
Diff
  • SELECT test_table.*, TRIM(UPPER(column5)) as column5
    FROM test_table
    ORDER BY 5 ASC
  • 1
    SELECT test_table.*, UPPER(column5) as column5
    
    1+
    SELECT test_table.*, TRIM(UPPER(column5)) as column5
    
    22
    FROM test_table
    
    3+
    ORDER BY 5 ASC
    
Code
Diff
  • package kata
    
    func sum(array []int) int {  
     result := 0  
     for _, v := range array {  
      result += v  
     }  
     return result  
    }  
    
    func Multiple3And5(number int) int {
      m := make([]int, 0)
      for i := 1; i < number; i++ {
        if i%3 == 0 || i%5 == 0 {     
          m = append(m, i)
        }
      }
      return sum(m)
    }
  • 11
    package kata
    
    22
    3
    func Multiple3And5(number int) int {
    
    3+
    func sum(array []int) int {  
    
    4+
     result := 0  
    
    5+
     for _, v := range array {  
    
    6+
      result += v  
    
    7+
     }  
    
    8+
     return result  
    
    9+
    }  
    
    44
    11+
    func Multiple3And5(number int) int {
    
    12+
      m := make([]int, 0)
    
    13+
      for i := 1; i < number; i++ {
    
    14+
        if i%3 == 0 || i%5 == 0 {     
    
    15+
          m = append(m, i)
    
    16+
        }
    
    17+
      }
    
    18+
      return sum(m)
    
    55
    }
    

Recent Moves:

Arrays

A gaming company has just built a slots game with 1 line.
Each line is made up of an array object displaying what landed in those slots.

In the code they pass this line into the function isWinner()
This will return an object which supplies a boolean to say if they have won and how many matches in the row there was.

The matches must start from the first entry and accumulate, a winner is only true when there is over 2 or more matches.

function isWinner(lineInfo){
  
}

A polynomial can be written in the form ax^n + bx^n-1 +.. z
Degree will be <=8.

Return an array of the unique real roots.

e.g. a=1, b=3, c=2, d=0 --> [0, -1, -2]

import numpy
import re
def real_solutions(a='x',b='x',c='x',d='x',e='x',f='x',g='x',h='x'):
    arr = [x for x in [a,b,c,d,e,f,g,h] if isinstance(x,int)]
    b = numpy.roots(arr).tolist()
    return list(dict.fromkeys([round(x.real,5) for x in b if abs(x.imag)<1e-5]))

i feel lucky today :)

Code
Diff
  • int returnHundred() // i feel lucky today :)
    {
      return (((rand() & rand()) % rand() << rand()) * rand() & rand()) >> rand() >> rand();
    }
  • 1
    int returnHundred() 
    
    1+
    int returnHundred() // i feel lucky today :)
    
    22
    {
    
    3
      return ('S'+'a'+'I'-'m')*2/1/9+'D';
    
    3+
      return (((rand() & rand()) % rand() << rand()) * rand() & rand()) >> rand() >> rand();
    
    44
    }
    
Code
Diff
  • SELECT DISTINCT TRIM(name) AS NAME
    FROM greetings
    ORDER BY NAME ASC
    LIMIT 10
  • 1
    SELECT DISTINCT name
    
    1+
    SELECT DISTINCT TRIM(name) AS NAME
    
    22
    FROM greetings
    
    33
    ORDER BY NAME ASC
    
    44
    LIMIT 10