This project contains programming challenges that can be solved by using the language of your choice, preferred Java, Go, JavaScript or Ruby.
You´re welcome to look inside /src/ folder. You may find helpful the code already implemented in ApplicationSample and ApplicationSampleTest classes.
- Create a fork of this repository into your own account.
- There are 9 challenges described below. Read them and think for a solution.
- Code your solution for each challenge. (Preferred using Java, Go, JavaScript or Ruby)
- Test your solution. You are free to test the project as you wish.
- Commit your code and push it to your own repository.
- Create a pull request to the main repo(Skills Project).
Providing an input (years) and assuming it´s always an int, return the number of centuries for provided input. How many centuries have N years?
yearsToCenturies(1)
==> 1
why? 1st century
yearsToCenturies(99)
==> 1
why? 1st century
yearsToCenturies(101)
==> 2
why? 2nd century
yearsToCenturies(2020)
==> 21
why? 21st century
This method search a text equality inside another text like SCRAMBLE. You can only use the amount of letters provided in the original word for your searching string. No more instructions needed, right?
scramble("hdsasdellsdasooawwadwdwawrl", "helloworld")
==> True
scramble("dsasdeldasooawwadwdwaw", helloworld)
==> False
(There is no "h")
scramble("hd ell oo w rl", "helloworld")
==> True
Find a middle char(s) (max 2) in a text. Always expect a single word without spaces.
getMiddle("pair")
==> ai
getMiddle("odd")
==> d
getMiddle("finish")
==> ni
Find how many letters are repeated into a word. Note that case-sensitive is irrelevant and spaces don´t count.
duplicateCount("hey")
==> 0
No word is repeated
duplicateCount("hello")
==> 1
Letter 'l' is repeated
duplicateCount("AcCoMmOdatIOn")
==> 4
Letters 'a', 'c', 'o' and 'm' are repeated.
Count the number of vocals that are contained in the provided text. Consider multiple words and upper/lower cases.
countVocals("n0n3")
==> 0
countVocals("aeiou AEIOU")
==> 10
countVocals("vowel counting is not an everyday thing")
==> 12
You should recursively multiply all numbers contained in certain number until you have a 1-digit number.
recursiveMultiply(20)
==> 0
why? [2 * 0] = 0
recursiveMultiply(236)
==> 8
why? [2 * 3 * 6] = 36 [3 * 6] = 18 [1 * 8] = 8
You must recursively sum all numbers contained in certain number until you have a 1-digit number.
recursiveSum(20)
==> 2
why? [2 + 0] = 2
recursiveSum(236)
==> 2
why? [2 + 3 + 6] = 11 [1 + 1] = 2
You must return an array of paired chars for the provided input phrase. Spaces and odd phrases are valid
coupleArray("hey")
==> ["he", "y"]
coupleArray("hello world")
==> ["he", "ll", "o ", "wo", "rl", "d"]
coupleArray("Give me some pairs please")
==> ["Gi","ve"," m","e ","so","me"," p","ai","rs"," p","le","as","e_"]
This method convert a long into a valid IP address.
How?
- Convert a
long
inbinary
(you will always get32 bits
or fewer, if there is less just apply the pad to the left with zero). - Get 4 bytes (4 groups of 8 bits will give you 4 bytes).
- Converts each byte to a decimal number.
- Apply the IP format to your 4 decimal numbers.
longToIP(2147483467L)
==> 127.255.255.75