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.

### nth Fibonacci

Return a the number in the nth position of the Fibonacci sequence.

Example:
// Returns 34
get_fibonacci_n(9);

``````#define PI 3.14159265358979323846
#include <stddef.h>
#include <math.h>

size_t get_fibonacci_n(double n) {
if (n < 0) return -1;
double PHI = (1 + sqrt(5)) / 2;
double a = pow(PHI, n) - pow(-PHI, -n);
return (size_t)floor(a / sqrt(5));
}``````

### String to math operation

Strings
Mathematics

Convert a string into a math operation and return the result.
If the operator is '=', return 1 for true or 0 for false depending if those numbers are equal

### !No false strings that have only one value or more operators!

You only have to worry about positive numbers

## Example

``````"10+10" => 20
"10 + 100" => 110
"50- 10" => 40
"10 *21" => 210
"50=50" => 1
"1=2" => 0
``````
``````fn math(e: &str) -> i32 {
let mut ope = '\0';
let mut first = 0;
let mut secon = 0;
for c in e.chars() {
match c {
'+' => {
ope = '+';
},
'-' => {
ope = '-';
},
'*' => {
ope = '*';
},
'/' => {
ope = '/';
},
'=' => {
ope = '='
}
'0'..='9' => {
if ope == '\0' {
first *= 10;
first += c as i32 - '0' as i32;
} else {
secon *= 10;
secon += c as i32 - '0' as i32;
}
}
' ' => {},
_ => {panic!("wrong value");}
}
}
return match ope {
'+' => first + secon,
'-' => first - secon,
'*' => first * secon,
'/' => first / secon,
'=' => (first == secon) as i32,
_ => panic!("no operator")
}
}``````
Failed Tests

### program to display the current date and time

Date Time

Write a Python program to display the current date and time.
Sample Output :
Current date and time :
2014-07-05 14:34:14

``````import datetime

now = datetime.datetime.now()

print("Current date and time:")
print(now.strftime("%Y-%m-%d %H:%M:%S"))``````

### Is it big?

is it big?

``````def p_e_n_1_s():
print('yes')``````

### Return 37

``````def thirty_seven(n)-> int:
"""This function must always return the integer 37"""
return n / sum([int(i) for i in str(n)])``````
Failed Tests

Challenge: Write a program that generates a strong password from a phrase entered by the user.

Rules:

The program should prompt the user to enter a phrase to use as the basis for the password.
The program should validate the input to ensure that it contains at least 12 characters and at least one of each of the following types: uppercase letters, lowercase letters, digits, and symbols (punctuation marks and special characters).
If the input is valid, the program should generate a strong password using the following steps:
Remove any non-alphanumeric characters from the input phrase and convert it to lowercase.
Shuffle the characters in the phrase to create a randomized version of it.
Generate a random string of digits and symbols with a length of at least 6 and at most 10 characters.
Combine the shuffled phrase and the random string of digits and symbols to form the password.
The program should print the generated password to the console.

``````import random
import string

# Remove any non-alphabetic characters and convert to lowercase
phrase = ''.join(filter(str.isalpha, phrase)).lower()

# Shuffle the characters in the phrase
phrase_chars = list(phrase)
random.shuffle(phrase_chars)
shuffled_phrase = ''.join(phrase_chars)

# Generate a random string of numbers and symbols
num_symbols = random.randint(6, 10)
symbols = ''.join(random.choices(string.punctuation, k=num_symbols))

# Combine the shuffled phrase and symbols to form the password
password = shuffled_phrase[:6] + symbols + shuffled_phrase[6:]

### Memorizing Pi

Mathematics

"How I wish I could calculate pi"

The length of each word in the sentence constructs the first seven digits of `pi` π.

• 3.141592
``````def memorizing_pi():
"""Returns the first sven digits of pi"""
memory = [str(len(i)) for i in 'How I wish I could calculate pi'.split()]
memory.insert(1, '.')
return float(''.join(memory))``````

### Anagram

Write a function that takes two strings as arguments and returns true if they are anagrams of each other, and false otherwise. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

For example, the strings "iceman" and "cinema" are anagrams of each other.

Function Signature: function isAnagram(str1, str2)

Input:

Two strings str1 and str2 of length n (1 ≤ n ≤ 10^3) containing only lowercase letters.
Output:

A boolean value true if the two input strings are anagrams of each other, and false otherwise.
Example:

isAnagram('listen', 'silent'); // true
isAnagram('race', 'care'); // true
isAnagram('night', 'thing'); // false

``````function isAnagram(str1, str2) {
if (str1.length !== str2.length) {
return false;
}

const frequency = {};

for (let i = 0; i < str1.length; i++) {
const char = str1[i];
if (frequency[char]) {
frequency[char]++;
} else {
frequency[char] = 1;
}
}

for (let i = 0; i < str2.length; i++) {
const char = str2[i];
if (!frequency[char]) {
return false;
} else {
frequency[char]--;
}
}

return true;
}``````
Failed Tests

### Rakib20221's Kumite #2

``SELECT TOP(50) qs.execution_count AS [Execution Count], (qs.total_logical_reads)/1000.0 AS [Total Logical Reads in ms], (qs.total_logical_reads/qs.execution_count)/1000.0 AS [Avg Logical Reads in ms], (qs.total_worker_time)/1000.0 AS [Total Worker Time in ms], (qs.total_worker_time/qs.execution_count)/1000.0 AS [Avg Worker Time in ms], (qs.total_elapsed_time)/1000.0 AS [Total Elapsed Time in ms], (qs.total_elapsed_time/qs.execution_count)/1000.0 AS [Avg Elapsed Time in ms], qs.creation_time AS [Creation Time] ,t.text AS [Complete Query Text], qp.query_plan AS [Query Plan] FROM sys.dm_exec_query_stats AS qs WITH (NOLOCK) CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS t CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS qp WHERE t.dbid = DB_ID() ORDER BY qs.execution_count DESC OPTION (RECOMPILE);-- for frequently ran query -- ORDER BY [Avg Logical Reads in ms] DESC OPTION (RECOMPILE);-- for High Disk Reading query -- ORDER BY [Avg Worker Time in ms] DESC OPTION (RECOMPILE);-- for High CPU query -- ORDER BY [Avg Elapsed Time in ms] DESC OPTION (RECOMPILE);-- for Long Running query``

### hello world

Olá!

``````let hello = 'hello world!'
console.log(hello)``````