I decided to start this challenge to improve as a programmer and to enter to the laboral market with experience π
I completed the challenge!!
Special thanks to @zodux. He helped me a lot with ideas of algorithms and, also, to motivate me.
Happy Coding!! π βοΈ
- 8 Algorithms.
- 16 Algorithms.
- 32 Algorithms.
- (GOLD) Complete one algorithm EVERY DAY.
- (SECRET) Take the constructive critiques and get, at least, 1 algorithm optimized.
- (LEGENDARY) YOU ROCK!! Get all the achievements!!
Completed algorithms: 32
Chunkey Monkey makes an array to a multidimensional one.
Returns true if the string in the first element of the array contains all the letters of the second element of the array.
It will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. This removes all elements from the initial array that are of the same value as these arguments.
Returns the lowest index at which a value (second argument) should be inserted into an array (first argument). The returned value should be a number. For example,
WhereDoIBelong wdib = new WhereDoIBelong ([1, 2, 3, 4, 5], 1.8); System.out.println(wdib.getIndexToIns());should return 1 because it is greater than 1 (index 0), but less than 2 (index 1).
It compares two lists and returns a new list with any items only found in one of the two given arrays, but not both. In other words, returns the symmetric difference of the two arrays.
Performs a search and replaces on the sentence using the arguments provided and returns the new sentence. First argument is the sentence to perform the search and replace on. Second argument is the word that you will be replacing (before). Third argument is what you will be replacing the second argument with (after). Preserves the case of the original word when it is replacing it. For example if you mean to replace the word "Book" with the word "dog", it will be replaced as "Dog".
Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay". If a word begins with a vowel you just add "way" to the end.
Converts a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes.
Converts the given number into a roman numeral.
Returns the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number. As an example, passing 4 to the function should return 5 because all the odd Fibonacci numbers under 4 are 1, 1, and 3.
Sums all the prime numbers up to and including the provided number if it is a prime. For example:
SumAllPrimes sap = new SumAllPrimes(); System.out.println("Result: " + sap.getPrimeSum(10));Should return 17 'cause the sum of 2, 3, 5 and 7 is 17.
Finds the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters. The range will be an array of two numbers that will not necessarily be in numerical order. e.g. for 1 and 3 - find the smallest common multiple of both 1 and 3 that is evenly divisible by all numbers between 1 and 3.
A couple of numbers m and n are called friendly (or known as a friendly couple), if the sum of all divisors of m (excluding m) is equal to the
number n, and the sum of all divisors of the number n (excluding n) is equal to m (with m β n).
For example, the numbers 220 and 284 are a friendly couple because the unique numbers
that divide accurately 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, and:
1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284
Therefore, 220 is a friendly number. The only numbers that divide exactly 284 are 1, 2, 4, 71, and 142 and:
1 + 2 + 4 + 71 + 142 = 220
Therefore, 284 is a friendly number.
In finance, the net present value is an indicator of how profitable will be a project.
Is calculated adding the flows of money each month divided by (1+r)^n, where n is the number of the month and r is the rate of monthly discount, and subtracting the initial investment.
For example, in a project in which the initial investment is $900, money flows for the first four months are $550, $230 and $341 $190, and the monthly discount rate is 4%, the net present value is:
NPV = β900 + (550 / (1+0.04)^1) + (230 / (1+0.04)^2) + (341 / (1+0.04)^3) + (190 / (1+0.04)^4).
If the NPV gives negative, then it is not suitable to begin the project.
The harmonic mean of a sequence of n real numbers x1, x2,..., xn is defined as:
H = n / ( (1 / x1) + (1/ x2) + (1 / x3) + β¦ + (1 / xn) )
A food machine has products of three types, A, B and C, which are respectively worth $270, $340 and $390. The machine accepts and gives of returned $10, $50 and $100 coins.
This allows to calculate approximately the square root of a number according to the following procedure:
- It takes the initial number and subtracts the first odd number (one), this result is subtracts the next
odd number and so on until the result of the subtraction is less than or equal to zero.- If the final result is equal to zero is treated in a number with whole root and will be given by the number
of times that became the subtraction, including zero.- If the result is less than zero, the number has no root perfect and the approximate result (truncated) shall
be given by the number of times that became the subtraction minus one.
Truncate a string (first argument) if it is longer than the
given maximum string length (second argument). Return the truncated string with a ... ending.
Note that inserting the three dots to the end will add to the string length.
However, if the given maximum string length num is less than or equal to 3, then the addition of the three dots does not add to the string length in determining the truncated string.
Check if a string (first argument, str) ends with the given target string (second argument, target).
Returns the factorial of the provided integer.
It looks through an array (first argument) and returns the
elements in the array that passes a truth test (second argument).
Here, I used lambda to pass a method as a parameter.
Repeats a given string (first argument) num times (second argument).
Returns an empty string if num is not a positive number.
Returns the sum of those two numbers and all numbers between them.
Returns a binary translated sentence of the passed English string.
1001000 1100101 1111001 100001 100001 100000 1010100 1101000 1101001 1101110 1101011 100000 1110000 1101111 1110011 1101001 1110100 1101001 1110110 1100101 100001 100000 1000101 1110110 1100101 1110010 1111001 1110100 1101000 1101001 1101110 1100111 100000 1101001 1110011 100000 1110000 1101111 1110011 1110011 1101001 1100010 1101100 1100101 100000 1110111 1101000 1101001 1101100 1100101 100000 1111001 1101111 1110101 100000 1101000 1100001 1110110 1100101 100000 1100110 1100001 1101001 1110100 1101000 100000 1101001 1101110 100000 1101001 1110100 101110
Returns true if the given string is a palindrome. Otherwise, returns false.
A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.
Returns the provided string with the first letter of each word capitalized.
Returns the remaining elements of an array after chopping off n elements from the head.
The head means the beginning of the array, or the zeroth index.
Dice notation (also known as dice algebra, common dice notation, RPG dice notation, and several other titles)
is a system to represent different combinations of dice in role-playing games using simple algebra-like notation such as 2d6+12.
Here, you can roll a D4, D6, D8, D10, D12, D20, D30, D100.
Converts the characters &, <, >, " (double quote), and ' (apostrophe), in a string to their corresponding HTML entities.
This algorithm receives as input the lengths of the two sides a and b of a right triangle, and which give
as output the length of the hypotenuse c of the triangle, given by the Pythagorean theorem:
cΒ² = aΒ² + bΒ²
The sequence of Collatz of an integer is constructed in the following way:
- If the number is even, it is divided by two;
- If is odd, it multiplies three and adds one;
- the succession ends upon arrival at one.
The Collatz conjecture says that, starting from any number, the sequence will always reach 1.
Despite being an affirmation to simple sight is very simple, it has not been able to demonstrate whether it is true or not.
Using computers, it has been verified that the succession actually
reaches 1 departing from any natural number less than 2^58.
Do you need something ? Stackoverflow is the answer :D !
It has two easter eggs