Get the Sum of Digits / Digital Root using Java
The challenge
Digital root is the recursive sum of all the digits in a number.
Given n, take the sum of the digits of n. If that value has more than …
In-depth guides, insights, and best practices for modern software engineering
Digital root is the recursive sum of all the digits in a number.
Given n, take the sum of the digits of n. If that value has more than …
We want to create a function that will add numbers together when called in succession.
add(1)(2);
# returns 3
We also want to be able to …
Read Article →Create a function that takes a positive integer and returns the next bigger number that can be formed by rearranging its digits. For …
Read Article →As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the sequence to …
Read Article →You are given three piles of casino chips: white, green and black chips:
An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a …
Read Article →Write a function to find the longest common prefix string amongst an array of strings. This string manipulation challenge requires …
Read Article →he count-and-say sequence is the sequence of integers with the first five terms as following:
1 is read off as "one 1" or 11 …
Given a non-empty array of digits representing a non-negative integer, increment one to the integer. This challenge involves array …
Read Article →Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have …
Read Article →You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Note:
You have to rotate the image …
Read Article →Determine if a 9×9 Sudoku board is valid. Only the filled cells need to be validated according to the …
Read Article →