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

initializes a variable sum to store the cumulative sum. Then, it uses a for loop to iterate over all numbers from 1 to num - 1. For each number, it checks if it is divisible by either 3 or 5 using the modulus operator. If it is, the number is added to the sum. Finally, the function returns the sum.

Code
Diff
  • package kata
    
    func Multiple3And5(num int) int {
      sum := 0
    	for i := 1; i < num; i++ {
    		if i%3 == 0 || i%5 == 0 {
    			sum += i
    		}
    	}
    	return sum
    }
    • package kata
    • func Multiple3And5(number int) int {
    • func Multiple3And5(num int) int {
    • sum := 0
    • for i := 1; i < num; i++ {
    • if i%3 == 0 || i%5 == 0 {
    • sum += i
    • }
    • }
    • return sum
    • }
Code
Diff
  • fn prime(x: u64) -> bool {
        x == 2 || x > 2 && (2..=(x as f64).sqrt().ceil() as u64).all(|d| x % d != 0)
    }
    • def prime(x):
    • counter = 0
    • for i in range(1,x):
    • if x % i is 0:
    • counter += 1
    • if counter is 0:
    • return True
    • else:
    • return False
    • fn prime(x: u64) -> bool {
    • x == 2 || x > 2 && (2..=(x as f64).sqrt().ceil() as u64).all(|d| x % d != 0)
    • }
Code
Diff
  • fn verify_sum(name_one: &str, name_two: &str) -> bool {
        name_one.chars().map(u32::from).sum::<u32>() == name_two.chars().map(u32::from).sum::<u32>()
    }
    • class Kata{
    • public static String verifySum(String nameOne, String nameTwo) {
    • int[] sumOfNames = new int[]{0, 0};
    • if (nameOne == null || nameTwo == null) {
    • return "NULL";
    • }
    • for (int i = 0; i < nameOne.length(); i++){
    • sumOfNames[0] += nameOne.charAt(i);
    • }
    • for (int i = 0; i < nameTwo.length(); i++){
    • sumOfNames[1] += nameTwo.charAt(i);
    • }
    • return sumOfNames[0] == sumOfNames[1] ? "TRUE" : "FALSE";
    • }
    • fn verify_sum(name_one: &str, name_two: &str) -> bool {
    • name_one.chars().map(u32::from).sum::<u32>() == name_two.chars().map(u32::from).sum::<u32>()
    • }
Code
Diff
  • -- Code Here
    SELECT * 
    FROM employees emp
    WHERE emp.salary >= ( (100^3)*5 ) AND emp.months >= 12
    ORDER BY emp.salary DESC
    • --- Code Here
    • -- Code Here
    • SELECT *
    • FROM employees emp
    • WHERE emp.salary >= ( (100^3)*5 ) AND emp.months >= 12
    • ORDER BY emp.salary DESC
Code
Diff
  • def is_palindrome(s: str) -> bool:
        s = ''.join(l for l in s.lower() if 96 < ord(l) < 123)
        return s == s[::-1]
    • import string
    • def is_palindrome(s: str) -> bool:
    • forward = s.lower().replace(" ", "").translate(str.maketrans('', '', string.punctuation))
    • reverse = forward[::-1]
    • if forward == reverse:
    • return True
    • else:
    • return False
    • s = ''.join(l for l in s.lower() if 96 < ord(l) < 123)
    • return s == s[::-1]
Code
Diff
  • const addArr = arr => arr.reduce((sum, num) => sum + num, null);
    
    • const addArr = (arr) => {
    • let sum = 0;
    • for (let i = 0; i < arr.length; i++) {
    • sum += arr[i];
    • }
    • return sum || null;
    • };
    • const addArr = arr => arr.reduce((sum, num) => sum + num, null);
Code
Diff
  • SELECT
      city_name, 
      SUM(confirmed_cases) confirmed_cases , 
      SUM(recovered_cases) recovered_cases, 
      SUM(death_cases) death_cases
      FROM cases 
      JOIN dati 
    ON dati.code = cases.dati_code
    GROUP BY city_name
    ORDER BY confirmed_cases DESC;
    • -- Code Here
    • SELECT
    • city_name,
    • SUM(confirmed_cases) confirmed_cases ,
    • SUM(recovered_cases) recovered_cases,
    • SUM(death_cases) death_cases
    • FROM cases
    • JOIN dati
    • ON dati.code = cases.dati_code
    • GROUP BY city_name
    • ORDER BY confirmed_cases DESC;
Code
Diff
  • def return_hundred():
        kk = 100
        return kk 
    #1
    • def return_hundred():
    • kk = 100
    • return kk * 10000000000000000000000000000000000000000000000 // 10000000000000000000000000000000000000000000000
    • return kk
    • #1

crypto fun

the cypher repeats the following 10 times: left_shift_by(b64encode(a), turn_number)
so to decode you do: b64decode(right_shift_by(code, turn_number))

Code
Diff
  • def should_return_1():
        code = b'jRXbVZyV2pOVk1HUlhVMGRLUjFSc1pHeGlXRTQwVm0wd2QyVkhVWGhTV0doWFYwZG9WVmx0ZEhkVlJscDBUVmM1VjFadGVIbFhhMk0xVmpGS2RHVkliRmhoTWsweFdWZHplRll4WkhWaFJtUlRaV3RGZUZacVFtdFRNVWw0Vkc1T2FGSnRVbGhhVjNSR1pVWmtWMVZyU214U2JHdzBWa2MxUzJGV1NuTlhia0pXWWxob2VsUlVSbXRXTVdSMFVteFNUbUpGY0VwV2JURXdZVEpHVjFOdVVsWmlSMmhoV1d0YVYwMHhjRlpYYlVacVlrWndNRlZ0ZUd0aFZscHpZMFp3VjJKSFVYZFdha1poVTBaT2NscEdhR2xTYTNCWVYxZDBhMVJyTVVkalJWWlRZbGhTV1ZWcVJrdFRWbkJHVjJ4T1ZXSlZXVEpXYlhSM1ZqRmFObEpZWkZwbGEzQklXWHBHVDFkWFRrZFhiV3hUWWtoQ1dWWXhaREJoTVZaeVRWVmtWbUpIYUhOVmJUVkRZMnhTVjFkdFJteFdiR3cxV1ROd1YxWXdNVVZTYTFwWFlsaFNNM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