Skip to content

Solutions of exercises that I have done throughout my career as a developer. I hope it helps you and don't hesitate to leave me a feedback!

Notifications You must be signed in to change notification settings

edwinml148/exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Codewars Exercises

Solutions of exercises that I have done throughout my career as a developer. I hope it helps you and don't hesitate to leave me a feedback!

1. Stop gninnipS My sdroW! ( 6 Kyu )

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 (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.

Link Kata : https://www.codewars.com/kata/5264d2b162488dc400000001/train/python

2. Bit Counting ( 6 Kyu )

Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.

Link Kata : https://www.codewars.com/kata/526571aae218b8ee490006f4/train/python

3. Your order, please ( 6 Kyu )

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.

Link Kata : https://www.codewars.com/kata/55c45be3b2079eccff00010f/train/python

4. Positions Average ( 6 Kyu )

Suppose you have 4 numbers: '0', '9', '6', '4' and 3 strings composed with them:

s1 = "6900690040"

s2 = "4690606946"

s3 = "9990494604"

Compare s1 and s2 to see how many positions they have in common: 0 at index 3, 6 at index 4, 4 at index 8 ie 3 common positions out of ten.

Compare s1 and s3 to see how many positions they have in common: 9 at index 1, 0 at index 3, 9 at index 5 ie 3 common positions out of ten.

Compare s2 and s3. We find 2 common positions out of ten.

So for the 3 strings we have 8 common positions out of 30 ie 0.2666... or 26.666...%

Example:

Given string s = "444996, 699990, 666690, 096904, 600644, 640646, 606469, 409694, 666094, 606490" composing a set of n = 10 substrings (hence 45 combinations), pos_average returns 29.2592592593.

Link Kata : https://www.codewars.com/kata/59f4a0acbee84576800000af/train/python

About

Solutions of exercises that I have done throughout my career as a developer. I hope it helps you and don't hesitate to leave me a feedback!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages