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
function prime_checker (n) {
  // Write a javascript function to check if N is a prime number
}
public class Kata {
  public static boolean[] populateBathroom(boolean[] urinals, int numOfPeople) {
    // Implement the urinal problem, described as "given x number of people walking 
    // into a bathroom that contains y number of urinals, describe the optimate
    // placement of people so that none is standing next to the other"
    // In this case, the urinals are represented by a boolean array with 
    // true representing a person at a urinal, and false meaning the urinal is empty
    return new boolean[] {true, false, true};
  }
}
const parse = (value = '') => {
  // if valid email, return true, else return false
  return true;
}

this is a test

def multiply(a, b):
    return a * b
function find_unique_items(array1, array2) 
{
  //Find the unique elements from two arrays
  return [1,2,4,6,8]
}

So basically turn an integer into a table of all the numbers from zero to that number

def int_to_table(num):
    tab = []
    for x in range(num + 1):
        tab.append(x)
    print(tab)
    return tab
import codewars_test as test
# TODO Write tests
import solution # or from solution import example

# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
    @test.it("test case")
    def test_case():
        test.assert_equals(int_to_table(9), [0,1,2,3,4,5,6,7,8,9])
        test.assert_equals(int_to_table(7), [0,1,2,3,4,5,6,7])
        test.assert_equals(int_to_table(4), [0,1,2,3,4])
public class FizzBuzz
{
    public string GetOutput(int number) {
      // Fizz buzz is a popular computer science interview question.  
      // The function above is given a number - if the number is
      // divisible by 3, return "fizz", if it's divisible by 5, 
      // return "buzz", if not divisble by 3 or 5 - return the
      // number itself.
      return "0";
    }
}

Description:
Your task is to remove every third char in a string,
using a zero based index

Example:

removeEverySecond('hello world'); // 'heloword'
removeEverySecond('how you doing') // 'howyoudoin'

function removeEveryThird(str) {
  // Remove the third character from every work in the string
  // using a zero based index
  return 'heloword';
}

Description:
Given an expression as a string, calculate its value. For example, given the string "1+2+3", return 6.

Order of operations should be respected: multiplication happens before addition.

Possible avenues for future exploration:

Adding support for subtraction and division
Stripping whitespace
Adding support for brackets

using System;
using System.Linq;

public class ArtihmeticParser
{
  public static int Evaluate(string input)
  {
    return input.Split("+").Select(EvaluateProduct).Aggregate(0,(a,b) => a+b);
  }
  
  private static int EvaluateProduct(string input)
  {
    return input.Split("*").Select(EvaluateInteger).Aggregate(1,(a,b) => a*b);
  }
  
  private static int EvaluateInteger(string input)
  {
    return int.Parse(input);
  }
}
using NUnit.Framework;
using System;

[TestFixture]
public class SolutionTest
{
  [Test]
  public void TestOneNumber3()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("3"), 3);
  }
  [Test]
  public void TestOneNumber10()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("10"), 10);
  }
  [Test]
  public void TestOneNumber729()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("729"), 729);
  }
  [Test]
  public void TestOneNumber0()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("0"), 0);
  }
  [Test]
  public void TestAdditionOfTwoNumbers2()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1+1"), 2);
  }
  [Test]
  public void TestAdditionOfTwoNumbers22()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("10+12"), 22);
  }
  [Test]
  public void TestAdditionOfThreeNumbers6()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1+2+3"), 6);
  }
  [Test]
  public void TestAdditionOfFiveNumbers()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1+2+3+4+5"), 15);
  }
  [Test]
  public void TestProductOfTwoNumbers1()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1*1"), 1);
  }
  [Test]
  public void TestProductOfTwoNumbers120()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("10*12"), 120);
  }
  [Test]
  public void TestProductOfThreeNumbers6()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1*2*3"), 6);
  }
  [Test]
  public void TestProductOfFiveNumbers()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1*2*3*4*5"), 120);
  }
  [Test]
  public void TestSumAndProduct()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("2+4*1"), 6);
  }
  [Test]
  public void TestOrderOfOperations()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("2+4*6"), 26);
  }
  [Test]
  public void TestLongerInput()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1000*3*2+100*2*2+2*2*2*2*5+9"), 6489);
  }
  [Test]
  [Ignore("Brackets")]
  public void TestBrackets()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("(2+4)*6"), 36);
  }
  [Test]
  [Ignore("Whitespace")]
  public void TestWhitespace()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate(" 2 + 4 *6  "), 26);
  }
  [Test]
  [Ignore("Subtraction")]
  public void TestSubtraction()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("1+3-2+4"), 6);
  }
  [Test]
  [Ignore("Subtraction")]
  public void TestOrderOfOperationsWithSubtraction()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("10+15-2*2+10-3*4"), 19);
  }
  [Test]
  [Ignore("Subtraction and brackets")]
  public void TestBracketsAndSubtraction()
  {
    Assert.AreEqual(ArtihmeticParser.Evaluate("100-2*(2+10-3)*4"), 28);
  }
}
// Write a project that demonstrates inheritance in C#