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.


You have to create an which abbreviation function. It will take string and return a string while taking the first and last char and replace the remaining with the number of chars.

For example:
internationalization => i18n
Localization => L10n
Deepak-Vishwa => D4k-V4a

function abbrev(str) {
  // TODO

Write a function that returns the value of a number divided by 2

div2(7) = 3
div2(10) = 5

unsigned long long div2(unsigned long long a){
  //Use binary operators...I-O
  return a >> 1;
// TODO: Replace examples and use TDD by writing your own tests

        Assert::That(div2(10), Equals(5));
        Assert::That(div2(0), Equals(0));
        Assert::That(div2(3), Equals(1));
        Assert::That(div2(65536), Equals(32768));
        Assert::That(div2(6553665535), Equals(3276832767));
        Assert::That(div2(1234567890), Equals(617283945));

take a number as input say (n) and add all the digit of this numnber until result is not equal to a single digit no.

EX. 1245358,
output=1+2+4+5+3+5+8=28, 28=2+8=10, 10=1+0=1
so, output=1


for i in range(n):
    if add>9:
        while add<10:
            for j in range(add):
hanukaFailed Tests



A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.

For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps. The number 32 has binary representation 100000 and has no binary gaps.

Write a function:

that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap.

For example, given N = 1041 the function should return 5, because N has binary representation 10000010001 and so its longest binary gap is of length 5. Given N = 32 the function should return 0, because N has binary representation '100000' and thus no binary gaps.

function binaryGap($n) {
def abbrev(str):
    return str[0] + str(len(str[1::-1])) + str[-1]
unit module Solution;
const s = `6,3,15,13,1,0`;

const input = s.split(',').map(Number);
const a = Array(2020);
const indexes = {};
const lastIndexes = {};
input.forEach((x, i) => ((a[i] = x), (indexes[x] = i), (lastIndexes[x] = i === input.length - 1 ? -1 : i)));

for (let i = input.length; i < 2020; i++) {
  const x = a[i - 1];
  if (indexes[x] === i - 1) {
    a[i] = 0;
    if (indexes[0] === undefined) indexes[0] = i;
    lastIndexes[x] = i - 1;
  a[i] = i - 1 - lastIndexes[x];
  lastIndexes[x] = i - 1;
  if (indexes[a[i]] === undefined) indexes[a[i]] = i;

console.log(a[2020 - 1]);
const add = (a, b) => a + b + 1;

Ваша задача - написать тело функции которая будет вычислять формулы.

Формула передаётся через параметр forlmula. Формулы могут содержать в себе все значения, но также можно передать переменные вида $1, $2, $3 и т.д.
Значения переменных передаются вторым параметром в неограниченном кол-ве.

Посмотрите тесты что бы понять что от вас требуется.

Удачи! Она вам потребуется ;)


Your task is to write the body of a function that will calculate formulas.

The formula is passed through the forlmula parameter. Formulas can contain all values, but you can also pass variables like $1, $2, $3, etc.
Variable values are passed as the second parameter in an unlimited number.

Look at the tests to understand what is required of you.

Good luck! You will need it;)

using System;

public class Calculator
  public static float Calculate(string forlmula, params float[] values)
    // your code
module Kata where

add_ :: Int -> Int -> Int
add_ a b = a + b