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
package kata

import (
 "math/rand"
	"time"
)

// CalcAgeOnMars calculates the age on Mars from on a age on Earth 
func Bogosort(array []int) []int {
  for !isSorted(array){
    shuffle(array)
  }
  if isSorted(array) {
    return array
  }
  return array
}

func isSorted(array []int) bool {
	for i := 1; i < len(array); i++ {
		if array[i-1] > array[i] {
			return false
		}
	}
	return true
}

func shuffle(slice []int) {
	rand.Seed(time.Now().UnixNano()) // seed the random number generator
	for i := len(slice) - 1; i > 0; i-- {
		j := rand.Intn(i + 1) // choose a random index in the slice
		slice[i], slice[j] = slice[j], slice[i] // swap the elements at the two indices
	}
}
import telebot

import requeste

bot = telebot.telebot("token")

@bot.message_handler(commands=['start'])

def start(message):

    bot.send_message(message.

chat.id,f"اهلا بك")

bot.bolling()
function foo() {}

Create a simple function that prints hello!

console.log("Hello")
def culitos(lista):
    perr4s = {
        1:"la del parque",
        2:"la de la farra",
        3:"me quiso violar",
        4:"me enamore",
        
    }
    
    if nombre not in perr4s:
        return "no esta en el ganado"
    else:
        return "esta pendiente para hablarle{}".format(perr4s[numero1])
    
    print(culitos(1))
Recursion
Mathematics

Problem statement

Write a function fibonacci(n) that takes a positive integer n as input and returns the nth number in the Fibonacci sequence. The Fibonacci sequence is a series of numbers in which each number after the first two is the sum of the two preceding ones. The sequence starts with 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on.

Constraints

The input integer n will be a positive integer not exceeding 50.

Notes

This problem can be solved using recursion, but using an iterative solution is also a valid approach.

function fibonacci(n) {
  if (n === 0) {
    return 0;
  }
  if (n === 1) {
    return 1;
  }

  return fibonacci(n - 1) + fibonacci(n - 2);
}
class Solution {
    public int similarPairs(String[] words) {
        return 1;
    }
}
Algorithms

Background

In 1937, a German mathematician named Lothar Collatz formulated a hypothesis that still remains unproven. The algorithm can be described as follows:

  • Step 1: Take any non-negative integer and non-zero integer and call it n.
  • Step 2: if n is even, evaluate a new n as n ÷ 2.
  • Step 3: otherwise, evaluate a new n as 3 * n + 1.
  • Step 4: if n does not equal 1, then repeat the process starting at step 2.

Task

Write a function named collatz_conjecture. The function takes a single parameter n, which is an integer, and executes the algorithm above. The function should also count the steps needed to achieve the task. The function should return a tuple consisting of two (2)integer objects, the output of n, and the number of steps needed to execute the task, in that order. If n is not non-negative or is not a non-zero integer return n and 0.

Make the program as simple or as complex as you like; however, utilize the algorithm, and return the expected output.

def collatz_conjecture(n: int) -> int:
    """A function that utilizes Collatz Conjecture"""
    if n <= 0 or not isinstance(n, int):
        # If so, return n, and zero
        return n
    
    # start Collatz Conjecture
    while True:
        # if n equals 1, return n
        if n <= 1:
            break

        # if n is even, divide it by 2
        elif n % 2 == 0:
            n //= 2
        else:
            # else multiply n by 3 and add 1.
            n *= 3
            n += 1
    return n
const chai = require("chai");
const assert = chai.assert
 while (1) {
        char enemy1[257]; // name of enemy 1
        scanf("%s", enemy1);
        int dist1; // distance to enemy 1
        scanf("%d", &dist1);
        char enemy2[257]; // name of enemy 2
        scanf("%s", enemy2);
        int dist2; // distance to enemy 2
        scanf("%d", &dist2);

        // Write an action using printf(). DON'T FORGET THE TRAILING \n

        // Enter the code here
   /works pace/ mode / test. js.5
   /works pace/ mode test.  js.56
input.sort;
      var_b=();
      wile var_a! input.length-1{}
  if var_a!=input (var_a) {}
      var_b push (var_a) ;
      {}
      var_a=var_a+1;
      ()
      var_b;
      isa azrayı seviyo 
      invalid symbol '[' - skipping word
./solut 
      3x olut placa'[' - skipping
      Testing arg1 arg2
           01  arg1        pic s9(5).
       01  arg2        pic s9(5).
       01  arg1-str    pic -9(5).
       Random Tests
       testsuite "Random Tests".
 perform set-random-seed
compute arg1 = function random() * 199999 - 99999
 compute arg2 = function random() * 199999 - 99999