Count the divisors of a number in Java
The challenge
Count the number of divisors of a positive integer n.
Random tests go up to n = 500000.
Examples
numberOfDivisors(4) == 3 // 1, 2, 4 …
Read Article →
In-depth guides, insights, and best practices for modern software engineering
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 →