In this article, we will discuss some of the frequently asked programming interview questions in Java.

If you are going for a Java developer/Senior developer job interview with big technical giants like Walmart Labs, Google, Ebay, Amazon, Apple,Yahoo etc.., you should be prepared for these algorithm questions.

Normally these companies use such questions to validate your understanding of programming concepts, data structures and algorithms.

Java Programming Questions on Strings

  1. How to remove duplicate characters from a String? (Solution)

  2. How to check if two Strings are anagrams of each other? (Solution)

  3. How to reverse a String in Java ? (Solution)

  4.  How to check if String is Palindrome? (Solution)

  5. How to check if a String is permutation of a Palindrome? (Solution)

  6. How to find the length of longest substring in a String without any repeating characters? (Solution)

  7. How to determine if the string has all unique characters (Solution)

  8. Replace all spaces in a string with %20 (Solution)

  9. How to find all possible substrings in a string? (Solution)

  10. How to find the longest common subsequence between two strings? (Solution)


Coding Interview questions on Numbers


  1. Write a Java program to check if given number is a prime number or not : (Solution)

  3. How to swap two numbers without using a temp variable in java ? (Solution)

  5. Write a Java program to find GCD of two numbers using recursion : (Solution)

  7. Write a java program to check if a number is Armstrong number : (Solution)

  9. Write a java program to Calculate power of a number using recursion :

  11. Find sum of digits of a number using recursion in java : (Solution)

  13. Convert a decimal number to binary using recursion in java : (Solution)

  15. Java program to find factorial of a number : (Solution)

  17. Java program to calculate Fibonacci series :(Solution)

  19. Java program to reverse a number and check if it is a Palindrome (Solution)


Coding Interview questions on Arrays


  1. How to find duplicates in an array ? (Solution)

  3. How to find reverse an array ? (Solution)

  5. How to find majority element in an unsorted array ? (Solution)

  7. How to find intersection of two unsorted arrays in Java ? (Solution)

  9. How to find an element in an Array in Java ? (Solution)


Coding Interview questions on Linked List


  1. How to add, update, remove elements from a Linked List ? (Solution)

  3. How to reverse a Linked List ? (Solution)

  5. How to detect a cycle in a singly LinkedList ? (Solution)

  7. How to merge two sorted linked lists ? (Solution)

  9. How to remove duplicates from a sorted linked list in Java ? (Solution)


Sorting Algorithms


Simple sorts

  1. Selection Sort program in Java
  2. Insertion Sort program in Java


Efficient sorts

  1. Heap Sort program in Java
  2. Merge Sort program in Java
  3. Quick Sort program in Java


Bubble sort and variants

  1. Bubble Sort program in Java
  2. Shell Sort program in Java


Distribution sorts

  1. Bucket Sort program in Java
  2. Radix Sort program in Java
  3. Counting Sort program in Java