04 June 2022
This page is under development and new code challenges are being added on daily basis. Please follow!
Prime Numbers
- Implement a method to check if a number is prime or not. Note that prime numbers are unsigned decimal numbers
which are only divisible by 1 and themselves, such as 2, 3, 5, 7, 11, 13, ....
- Implement a method which returns a list of prime numbers which are less than a number.
- Write a method to find all prime/non-prime numbers up to number n, and returns them by a map. (partition the
search region)
- Prime twins are prime numbers that one of them is reached by adding 2 to another (such as 11 and 13). Write a
method which returns are twins whic are less than a number.
String
- Implement a method which receives an array of Strings and returns a map String and and the number of the
corresponding occurrence.
- Implement a method to find the max occurrences of any String in the array
- implement a method which accepts an array of Strings and returns a distinct array.
- Implement a method to accept two arrays and return common elements.
- Implement two methods to find three longest and shortest strings in an array
- Implement a method which find max occurring word in a sentence.
- Write a method which checks if two given strings are anagrams. Note: two words are anagrams if they have the
same length and same characters but in any order.
- Write a method which checks if a given String is Pangrams. Note: a string is called Pangrams if it contains all
26 English alphabet.
- Implement a method which counts the number of uncommon elements in two arrays.
- Write a method which scans a string to find all digits, and then concat and convert to a Long object, and wrap
to a Optional.
- Write a method to extract all digits from a string and calculates the average value.
- Write a method which returns an concat value of an integer array
- Write a collector which collects elements of a stream randomly.
Collections
- Implement a method which merges a bunch (list) of java.util.List objects.
- Implement a method which merges a bunch (list) of java.util.List objects and only return DISTINCT elements.
- Implement a method which merges a bunch (list) of java.util.List strings and remove empty(s).
- implement a method which trims all elements of a list which are longer than n (int).
- Implement a method which received a java.util.Set and a java.util.List as keys and values of a map, and return the map.
Full source code of this article can be found on my GitHub repository.