Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

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.

Ad
Ad

Разработайте функцию sumNechet (a,b), возвращающую сумму всех нечетных чисел из диапазона от a до b (a < b). Для проверки текущего числа на нечетность создайте функцию нечетное (x)

sumNechet(0, 5) // 9

Code
Diff
  • function sumNechet(a, b) {
      let Sum = 0 
      for (let число = a; число <= b; число ++) {
        Sum += нечетное(число) ? число : 0 
      }
      return Sum
    }
    
    function нечетное(число) {
      return число % 2 == 1 ? true : false 
    }
    • function sumNechet(a, b) {
    • let Sum = 0
    • for (let число = a; число <= b; число ++) {
    • Sum += нечетное(число) ? число : 0
    • }
    • return Sum
    • }
    • function нечетное(число) {
    • return число % 2 == 1 ? true : false
    • }

Building upon previous idea, trying a more concise but less readable representation of the various game combinations.

Code
Diff
  • function rps(a,b) {
      return a==b
        ? 'Draw!'
        : `Player ${1+['sr','ps','rp'].includes(a[0]+b[0])} won!`;
    }
    
    • function rps(player1, player2) {
    • return player1 == player2 ? 'Draw!' :
    • player1 == 'rock' && player2 == 'scissors' ||
    • player1 == 'scissors' && player2 == 'paper' ||
    • player1 == 'paper' && player2 == 'rock' ? 'Player 1 won!' : 'Player 2 won!';
    • function rps(a,b) {
    • return a==b
    • ? 'Draw!'
    • : `Player ${1+['sr','ps','rp'].includes(a[0]+b[0])} won!`;
    • }
Code
Diff
  • SELECT * FROM employees ORDER BY employees.salary desc LIMIT 10
    • -- Code Here
    • SELECT * FROM employees ORDER BY employees.salary desc LIMIT 10
Code
Diff
  • select * from transactions where transactions.customer is not null
    order by transactions.store asc, transactions.total_price desc
    • -- Code Here
    • select * from transactions where transactions.customer is not null
    • order by transactions.store asc, transactions.total_price desc
Code
Diff
  • select * from transactions
    • -- Code Here
    • select * from transactions
Code
Diff
  • function addArr(arr){
      if(arr.length == 0) return null
      return arr.reduce((acc, i) => acc + i, 0)
    }
    • function addArr(arr){
    • if(arr.length === 0) return null
    • let final = 0
    • arr.forEach(num => {
    • final += num
    • })
    • return final
    • if(arr.length == 0) return null
    • return arr.reduce((acc, i) => acc + i, 0)
    • }
Code
Diff
  • select * from transactions
    where customer like 'S%' and customer like '%r';
    • -- Code Here
    • select * from transactions
    • where customer like 'S%' and customer like '%r';
Code
Diff
  • -- Code Here
    SELECT * FROM Transactions
    WHERE Store NOT IN ('BIE Store Bandung','BIE Store Jakarta')
    • --- Code Here
    • -- Code Here
    • SELECT * FROM Transactions
    • WHERE Store NOT IN ('BIE Store Bandung','BIE Store Jakarta')
Code
Diff
  • select date, store, total_price from transactions
    where date between '2022-01-01' and '2022-01-03'
    ;
    • -- Code Here
    • select date, store, total_price from transactions
    • where date between '2022-01-01' and '2022-01-03'
    • ;
Code
Diff
  • -- Code here
    select * from customers where kota ='Tasikmalaya'
    • --- Code here
    • -- Code here
    • select * from customers where kota ='Tasikmalaya'