Java solutions and unit tests to programming challenge problems often asked in interviews
Two strings: a and b, are called anagrams if they contain all the same characters in the same frequencies. For example, the anagrams of CAT are CAT, ACT, TAC, TCA, ATC, and CTA. Create a function to determine if two strings are case-insensitive anagrams. Return true if they are otherwise return false.
Assume that you have a very large database table of customers.
Each customer row has an age.
Parse all rows of data (Assume it is provided as an Array) and get a count of every age.
- Note: In the actual scenario you would determine the appropriate data structure.
Find the maximum difference between elements in an array.
The max difference is the largest element minus the smallest element that proceeds it in the array.
If no such number exists, then return -1.
A palindrome date is one that reads the same numerically forwards and backwards.
For example: 10 02 2001
Given a string representing a start date and a string end date, both in the format MM/dd/yyyy
,
return a Set of LocalDates in chronological order containing all palindrome dates in that range inclusively.
Given a number, determine if it is prime or not, returning a boolean representing if it is prime.
Given two strings: a and b, create a string merging the characters of alternating between a and b.
Examples:
Given: abcd, efgh
Return: aebfcgdh
Given: abcdef, xyz
Return: axbyczdef
Given a sequence of numbers, starting at 1 and counting up by 1 sequentially and one number is missing, determine the missing number
Example:
1,2,3,4,5,7,8,9