Skip to content

My Java solutions to common challenge problems (with unit tests)

Notifications You must be signed in to change notification settings

zeatful/ChallengeProblems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Challenge Problems

Java solutions and unit tests to programming challenge problems often asked in interviews

Anagram

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.

Database Age

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.

Max Difference

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.

Palindrome

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.

Prime

Given a number, determine if it is prime or not, returning a boolean representing if it is prime.

String Merge

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

Missing Integer Sequence

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

About

My Java solutions to common challenge problems (with unit tests)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages