Java Coding Interview Questions
Easy
1. Reverse a string without using a built-in reverse function.
2. Find the largest and smallest element in an array.
3. Check whether a string is a palindrome.
4. Check whether two strings are anagrams.
5. Remove duplicate elements from an array.
6. Count the frequency of each element in an array.
7. Find the intersection of two arrays.
8. Move all zeros in an array to the end while maintaining the order of the other elements.
9. Check whether a number is prime.
10. Find the factorial of a number using recursion.
11. Generate the Fibonacci sequence using both iteration and recursion.
12. Check whether a number is a palindrome.
13. Find the greatest common divisor of two numbers.
14. Implement linear search without using built-in search functions.
15. Sort an array using bubble sort.
16. Sort an array using insertion sort.
17. Sort an array using selection sort.
Medium
18. Find the second largest element in an array without sorting the array.
19. Find the first non-repeating character in a string.
20. Find the missing number in an array containing numbers from 1 to n.
21. Find all duplicate elements in an array.
22. Find the maximum sum of a contiguous subarray.
23. Merge two sorted arrays into one sorted array.
24. Find whether an array contains two numbers that add up to a given target.
25. Rotate an array to the right by k positions.
26. Find the longest substring without repeating characters.
27. Reverse an integer without converting it to a string.
28. Implement binary search on a sorted array.
29. Implement a stack using an array.
30. Implement a queue using an array.
31. Reverse a linked list.
32. Find the middle node of a linked list.
33. Merge two sorted linked lists.
34. Implement a function to check whether parentheses are balanced.
Hard
35. Detect whether a linked list contains a cycle.
36. Find the height of a binary tree.
37. Perform inorder, preorder, and postorder traversal of a binary tree.
38. Find the maximum depth of a binary tree.
39. Determine whether two binary trees are identical.
40. Find the lowest common ancestor of two nodes in a binary tree.
Post #1463
62
- ❤ 1