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

Task 2: "FizzBuzz"
 
  Write a function fizzBuzz (n) that takes an integer as argument.
  The function should output numbers from 1 to n to the console, replacing the numbers:

  • multiples of three - on fizz;
  • multiples of five - on buzz;
  • multiples of three and five at the same time - on fizzbuzz.

function fizzBuzz(num) {
    for (let i=1;i <= (num); i++) {
        let fb = '';
        if (i%3===0) {fb = fb + 'fizz'};
        if (i%5===0) {fb = fb + 'buzz'};
        if (fb==='') { console.log(i); } else { console.log(fb); };
    }
};

fizzBuzz(15); //

Task: “Expand words in a sentence”

   Write a reverseWords (str) function that accepts a string as input. The function should return a new line, putting the words in reverse order. If the line has punctuation marks, you can delete or leave them - at your discretion.

function reverseWords(str) {
    return str.split(" ").reverse().join(" ")
}
Arrays
Data Types

Very simple Kata, simply print out every int in the Array.

Like if you solved :D

public class myWorld{
  public void printArray(int[] arr){
    for(int i = 0; i < arr.length; i++){
      System.out.println(arr[i]);
    }
  }
}
char * fanis (char * input, int value) {
  int    length = strlen (input);
  char * output = (char *) malloc (sizeof(char) * (length + 1));
  
  memcpy (output, input, length + 1);
  
  return output;
}

Create a function that returns the sum of the ASCI-value of each char in the given string.

using System;
namespace Solution{
  public class ToAsci
  {
      public static int getAsciSum(string s)
          {
              int returner = 0;
              foreach (var el in s)
                  returner += (int)el;
              return returner;
          }
  }
}

Suppose you have a software, that will distribute invoices to different billing service providers.

You have a user interface, where you can set the ratio in which the bills are to be distributed to the providers. Back in the software, all bills run in a shuffle function. This function is called with the config from the user interface, that contains the providers and the ratio in which the providers should be chosen.

The Function is generic, so you can send any type you want in the function. This is a very easy way to implement a dynamic load distribution.

If you call the function 1000 times or more, the distribution is very close by your configuration.

using System;
using System.Collections.Generic;
using System.Linq;

namespace Solution
{
    public class ObjectShuffler
    {
       private Random rnd = new Random();

        public T Shuffle<T>(Dictionary<T, int> parameterDict)
        {
            //Remove wrong configuration.
            parameterDict = (from i in parameterDict
                             where i.Value > 0
                             select i).ToDictionary(x => x.Key, x => x.Value);

            //Error Handling
            if (parameterDict.Count == 0)
            {
                throw new Exception("Can't shuffle an empty list."); 
            }

            //Do Work
            var sumItemsValue = (from x in parameterDict select x.Value).Sum();
            var randNr = this.rnd.Next(1, sumItemsValue + 1);
            var stepSum = 0;

            foreach (var item in parameterDict)
            {
                stepSum = stepSum + item.Value;
                if (randNr <= stepSum)
                {
                    return item.Key;
                }
            }
            // This can't happen.
            throw new Exception("Run to far.");
        }
    }
}

I've done a 7kyu kata. The task was to return the same table, but with one column changed.

Say they want to to upper one column, but other columns should remain the same.
In that kata there were only 4 columns.
And all top soulutions was like this:
SELECT column1, column2, column3, UPPER(column4)

But i came with an idea and soulution for the case when there are say 10 columns.

Instead of making a big selecet statement we can do like this:

SELECT *, UPPER(column5) as column5
FROM test_table

just trying how this works

public func holabro(){
  a=1
  return ""
}
public class ThirdAngle {
    public static int otherAngle(int angle1, int angle2) {
       
        return 180-(angle1+angle2);
    }
}
char* Hi (void)
{char* ans;
asprintf(&ans, "Hello World.");
return ans;}