Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solutions to Codewars problems

Problems

Your algorithm must output the exact integer answer, to full precision. Also, it must correctly handle negative numbers as input.

  • Python
  • C++

Write a function that accepts a square matrix (N x N 2D array) and returns the determinant of the matrix.

  • Python
  • C++

Write a function that counts how many different ways you can make change for an amount of money, given an array of coin denominations. For example, there are 3 ways to give change for 4 if you have coins with denomination 1 and 2:

1+1+1+1, 1+1+2, 2+2. Also, assume that you have an infinite amount of coins.

Your function should take an amount to change and an array of unique denominations for the coins

  • Python
  • C++

Write a class called User that is used to calculate the amount that a user will progress through a ranking system similar to the one Codewars uses.

  • Python
  • C++

  • Python
  • C++

Create a class called Warrior which calculates and keeps track of their level and skills, and ranks them as the warrior they've proven to be.

  • Python
  • C++

Write a function called sumIntervals/sum_intervals() that accepts an array of intervals, and returns the sum of all the interval lengths. Overlapping intervals should only be counted once.

  • Python
  • C++

Let's make it so Bob never misses another interesting number. We've hacked into his car's computer, and we have a box hooked up that reads mileage numbers. We've got a box glued to his dash that lights up yellow or green depending on whether it receives a 1 or a 2 (respectively).

It's up to you, intrepid warrior, to glue the parts together. Write the function that parses the mileage number input, and returns a 2 if the number is "interesting" (see below), a 1 if an interesting number occurs within the next two miles, or a 0 if the number is not interesting.

  • Python
  • C++

Define a function that takes in two non-negative integers aaa and bbb and returns the last decimal digit of a^b b. Note that aaa and bbb may be very large!

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

file: alternating_substring.py

  • Python
  • C++

The marketing team is spending way too much time typing in hashtags. Let's help them with our own Hashtag Generator!

  • Python
  • C++

[5 kyu] Scramblies

Complete the function scramble(str1, str2) that returns true if a portion of str1 characters can be rearranged to match str2, otherwise returns false.

  • Python
  • C++

The Fibonacci numbers are the numbers in the following integer sequence (Fn) such as "F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1."

  • Python
  • C++

Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements. NOTE FROM @andrei399: THIS KATA MAY BE BROKEN IN PYTHON I'M NOT 100% SURE

  • Python
  • C++

Implement a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. Given a number, say prod (for product), we search two Fibonacci numbers F(n) and F(n+1) verifying: F(n) * F(n+1) = prod. Your function productFib takes an integer (prod) and returns an array:

[F(n), F(n+1), true] or {F(n), F(n+1), 1} or (F(n), F(n+1), True) depending on the language if F(n) * F(n+1) = prod. If you don't find two consecutive F(m) verifying F(m) * F(m+1) = prodyou will return:

[F(m), F(m+1), false] or {F(n), F(n+1), 0} or (F(n), F(n+1), False)]

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

Well met with Fibonacci bigger brother, AKA Tribonacci.

As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the sequence to generate the next. And, worse part of it, regrettably I won't get to hear non-native Italian speakers trying to pronounce it :(

  • Python
  • C++

The new "Avengers" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 dollar bill. An "Avengers" ticket costs 25 dollars.

Vasya is currently working as a clerk. He wants to sell a ticket to every single person in this line.

Can Vasya sell a ticket to every person and give change if he initially has no money and sells the tickets strictly in the order people queue?

Return YES, if Vasya can sell a ticket to every person and give change with the bills he has at hand at that moment. Otherwise return NO.

  • Python
  • C++

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.

  • Python
  • C++

file: beeraimd.py

  • Python
  • C++

It's a Pokemon battle! Your task is to calculate the damage that a particular move would do using the following formula (not the actual one from the game):

  • Python
  • C++

Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is present.

  • Python
  • C++

[6 kyu] Array.diff

Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result. It should remove all values from list a, which are present in list b.

array_diff([1,2],[1]) == [2]

If a value is present in b, all of its occurrences must be removed from the other:

array_diff([1,2,2,2,3],[2]) == [1,3]

  • Python
  • C++

Your task is to write a function that does just what the title suggests (so, fair warning, be aware that you are not getting out of it just throwing a lame bas sorting method there) with an array/list/vector of integers and the expected number n of smallest elements to return.

  • Python
  • C++

A child is playing with a ball on the nth floor of a tall building. The height of this floor, h, is known.

He drops the ball out of the window. The ball bounces (for example), to two-thirds of its height (a bounce of 0.66).

His mother looks out of a window 1.5 meters from the ground.

How many times will the mother see the ball pass in front of her window (including when it's falling and bouncing?

  • Python
  • C++

Implement a function, so it will produce a sentence out of the given parts. Array of parts could contain:

  • words

  • commas in the middle;

  • multiple periods at the end. Sentence making rules:

  • there must always be a space between words;

  • there must not be a space between a comma and word on the left;

  • there must always be one and only one period at the end of a sentence.

  • Python

  • C++


Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result.

Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).

If the input string is empty, return an empty string. The words in the input String will only contain valid consecutive numbers.

  • Python
  • C++

Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.

  • Python
  • C++

  • Python
  • C++

  • Python
  • C++

[7 kyu] Word values

  • Python
  • C++

CREDITS TO: edsoncelio for this text format, I think it's really neat.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages