Sum by Factors in Java
The challenge
Given an array of positive or negative integers
I= [i<sub>1</sub>,..,i<sub>n</sub>]
you have to produce a sorted …
Read Article →345 articles about java development, tools, and best practices
Given an array of positive or negative integers
I= [i<sub>1</sub>,..,i<sub>n</sub>]
you have to produce a sorted …
Read Article →Count the number of divisors of a positive integer n.
Random tests go up to n = 500000.
numberOfDivisors(4) == 3 // 1, 2, 4 …
Read Article →
Inspired from real-world Brainf**k, we want to create an interpreter of that language which will support the following instructions: …
Read Article →Write a function that returns the positions and the values of the “peaks” (or local maxima) of a numeric array.
For example, …
Read Article →Write a program that will calculate the number of trailing zeros in a factorial of a given number.
N! = 1 * 2 * 3 * ... * N
Be careful …
Read Article →Consider a “word” as any sequence of capital letters A-Z (not limited to just “dictionary words”). For any word …
Read Article →If you find yourself in a position where you have already committed some files to git, and they are in the remote repository already, but you want to …
Read Article →There is a secret string which is unknown to you. Given a collection of random triplets from the string, recover the original string.
A …
Read Article →A format for expressing an ordered list of integers is to use a comma separated list of either
Complete the solution so that it reverses all of the words within the string passed in.
Example:
ReverseWords.reverseWords("The …
Read Article →
Write a simple CamelCase method for strings.
All words must have their first letter capitalized without spaces.
// …
Read Article →
Create a function that takes an integer as an argument and returns “Even” for even numbers or “Odd” for odd …
Read Article →You need to square every digit of a number and concatenate them.
For example, if we run 9119 through the function, 811181 will come out, …
Read Article →You are given a string of numbers in sequence and your task will be to return the missing number. If there is no number missing or there …
Read Article →Create a function taking a positive integer as its parameter and returning a string containing the Roman Numeral representation of that …
Read Article →The action of a Caesar cipher is to replace each plaintext letter (plaintext letters are from ‘a’ to ‘z’ or from ‘A’ …
Read Article →The first century spans from the year 1 up to and including the year 100, The second – from the year 101 up to and including the year …
Read Article →You have a positive number n consisting of digits. You can do at most one operation: Choosing the index of a digit in the number, remove …
You are given a non-null array of integers. Implement the method arrayToTree which creates a binary tree from its values in accordance …
Read Article →You will have a list of rationals in the form
{ {numer_1, denom_1} , ... {numer_n, denom_n} }
or
[ [numer_1, denom_1] , ... [numer_n, …
Read Article →
Given a positive number n > 1 find the prime factor decomposition of n. The result will be a string with the following form : …
Read Article →The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers: …
Read Article →Let’s implement the Luhn Algorithm, which is used to help validate credit card numbers.
Given a positive integer of up to 16 …
Read Article →There is an array with some numbers. All numbers are equal except for one. Try to find it!
Solution.findUniq(new double[]{ 1, 1, 1, 2, …
Read Article →