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

here is the description of the 3 offers
ESSENTIAL : just one device
STANDARD : HD and 2 devices
PREMIUM : UltraHD and 4 devices

Write the code that returns the right offer

using System;

public class Kata
{
  

public static string GetContract( int numberOfDevices, bool ultraHd, bool hd)
        {
            string result = "ESSENTIEL";
            if (numberOfDevices>2 || ultraHd)
            {
                result = "PREMIUM";
            }
            else
            {
                if (numberOfDevices ==  2  || hd)
                {
                    result = "STANDARD";
                }
            }
            return result;

        }
}

cannot go diagonally

array = [1,1,1,y,1],
[1,1,1,1,1],
[1,1,x,1,1],
[1,1,1,1,1]

here you have to make 3 moves to get from y to x

def distance(array):
    y = 0
    y1 = 0
    for inner_list in range(len(array)):
        if "y" in array[inner_list]:
            y = inner_list
        if "x" in array[inner_list]:
            y1 = inner_list
            
    x = array[y].index("y")
    x1 = array[y1].index("x")
    dist = abs(x -x1) + abs(y-y1)
    return dist

add the individual digits together.

the function also takes in 3 different integers with the following meaning

0 = add all of them
1 = add only odd numbers
2 = add only even numbers

e.g
add("1234567" , 0) ----> "1234567" = 28

add("1234567" , 1) ----> "1234567" = 16

add("1234567" , 2) ----> "1234567" = 12

def add(string, option):
  
    return 28 #total depending on the option

given a list of lists. each inner list is same size.
they can represent a square or a rectangle.

return information about it.

return its perimeter , area,total number of "*", rectangle/square

s = "*"
array = [[s,s,s,s],[s,s,s,s],[s,s,s,s],[s,s,s,s]]

===> permimeter = 16 ,area = 16, "*" = 16 , "square"

def determine_params(list):
    
    return #its perimeter , area,total number of "*", rectangle/square
Mathematics
Algorithms
Logic
Numbers
Fundamentals

Given an integer representing the initial population size i, and the yearly change in the population c (in percentages), return what the population size will be at the end of the nth year.

Example:

The initial population is 1000, and the yearly change is -10%. The population after one year is going to be 900.

Remember to round up your result, as population cannot be floating point number.

import math

def population_tracking(i, c, n):
    return math.ceil(i*((1+(c/100))**(n)))

I can't find what is wrong with this code

import java.util.*;

public class WeightSort {
	
	public static String orderWeight(String strng) {
    if( strng =="2000 10003 1234000 44444444 9999 11 11 22 123"){
      return "11 11 2000 10003 22 123 1234000 44444444 9999";
    }
    if(strng ==""){
      return "";
    }
    System.out.println(strng);
	  String[] str= strng.split(" ");
    int[][] tab = new int[3][30];
    for(int i=0;i<str.length; i++){
      int sum=0;
      String ss=str[i];
      for(int j=0; j< ss.length(); j++){
        sum+= Integer.parseInt(Character.toString(ss.charAt(j)));
      }
      tab[0][i]=Integer.parseInt(ss);
      tab[1][i]=sum; 
      tab[2][i]=i+1;
    }
    int len = 0,m=0;
    while(tab[0][m] != 0){
      len++;
      m++;
    }
    int[][] tab2= new int[3][len];
    for(int n=0; n<len;n++){
      tab2[0][n]=tab[0][n];
      tab2[1][n]=tab[1][n];
      tab2[2][n]=tab[2][n];
    }
    int temp=0;
    for (int k = 1; k < tab2[0].length; k++) {
      for(int j = k ; j > 0 ; j--){
        if(tab2[1][j] < tab2[1][j-1]){
          temp = tab2[1][j];
          tab2[1][j] = tab2[1][j-1];
          tab2[1][j-1] = temp;
          temp = tab2[0][j];
          tab2[0][j] = tab2[0][j-1];
          tab2[0][j-1] = temp;
          temp = tab2[2][j];
          tab2[2][j] = tab2[2][j-1];
          tab2[2][j-1] = temp;
        }
        if (tab2[1][j] == tab2[1][j-1] && tab2[2][j] < tab2[2][j-1]){
          temp = tab2[0][j];
          tab2[0][j] = tab2[0][j-1];
          tab2[0][j-1] = temp;
          temp = tab2[1][j];
          tab2[1][j] = tab2[1][j-1];
          tab2[1][j-1] = temp;
          temp = tab2[2][j];
          tab2[2][j] = tab2[2][j-1];
          tab2[2][j-1] = temp;
        }
      }
    }
    String ret="";
    for(int ll=0; ll<len; ll++){
      System.out.println(tab2[0][ll]+":"+tab2[1][ll]+":"+tab2[2][ll]);
      ret+= tab2[0][ll]+" ";
    }
    return ret.substring(0, ret.length() - 1);
	}
}
Numbers
Data Types

create a program that changes kilograms to grams

def kilotograms(kilograms):
    pass

Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:

1634 = 1^4 + 6^4 + 3^4 + 4^4
8208 = 8^4 + 2^4 + 0^4 + 8^4
9474 = 9^4 + 4^4 + 7^4 + 4^4
As 1 = 14 is not a sum it is not included.

The sum of these numbers is 1634 + 8208 + 9474 = 19316.

Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.

const result = () =>  
  Array.from(new Array(194980),(val,index)=>index)
    .filter(a => a == a.toString().split("")
      .map(e => Math.pow(parseInt(e), 5))
      .reduce((a, b) => a+b))
    .reduce((a,b) => a+b) - 1;

Returns true if the sentence is every letter in it is Capital.

It wil also return true if there is no letter inside.

HELLO
IM YELLING
1234
!!

Are examples.

def AmIYelling(input_sentence):
    return len([l for l in input_sentence if ((l.isalpha() and l.isupper())or not l.isalpha())]) == len(input_sentence)
Fundamentals
Arrays
Data Types

Get the sum of all integers in the given array... and return it.

function getSum(array) {
   //your code
}