Zoho Important Coding Questions (Extended)
Core Coding Questions
1. Write a program to find the second largest element in an array without sorting.
2. Given a string, check if it is a palindrome without using library functions.
3. Find the missing number in an array of size n containing numbers from 1 to n.
4. Write a program to reverse a linked list.
5. Implement queue using two stacks.
6. Print the Fibonacci series without recursion.
7. Given a string, print the first non-repeating character.
8. Find the GCD and LCM of two numbers without using inbuilt functions.
9. Implement binary search and explain its time complexity.
10. Write a program to check if two strings are anagrams.
11. Find the subarray with maximum sum (Kadane’s Algorithm).
12. Rotate an array left/right by k positions.
13. Find the longest common prefix among an array of strings.
14. Count the frequency of each element in an array.
15. Remove all duplicates from a sorted/unsorted array.
16. Write a program to merge two sorted arrays without using extra space.
17. Find the majority element (element that appears more than n/2 times).
18. Check if a string is a valid parenthesis sequence (()[]{}).
19. Given a sentence, reverse the order of words.
20. Find the longest substring without repeating characters.
21. Check if a number is prime.
22. Print all prime factors of a number.
23. Find Armstrong numbers in a given range.
24. Convert a decimal number to binary without using inbuilt functions.
25. Find the n-th smallest/largest element in an array without sorting.
26. Given two numbers, check if they are co-prime.
27. Find the factorial of a number (iterative & recursive).
28. Count number of trailing zeroes in factorial of n.
29. Generate Pascal’s triangle up to n rows.
30. Find nth Fibonacci number using DP.
31. Print a spiral matrix.
32. Given an encoded string like 'a2b3c1', expand it → 'aabbbc'.
33. Print a diamond/star pattern.
34. Implement a function to check if a given Sudoku board is valid.
Linked List & Stack/Queue
- Detect if a linked list has a cycle (Floyd’s Cycle Detection).
- Find the middle element of a linked list.
- Merge two sorted linked lists.
- Implement a min stack (stack with O(1) getMin).
- Implement two stacks using one array.
- Reverse a linked list in groups of k.
- Implement a queue using a linked list.
- Evaluate a postfix expression using stack.
Recursion & Backtracking
- Solve the Tower of Hanoi problem.
- Print all subsets of a given string/array.
- Generate all permutations of a string.
- Find the n-th term in the Josephus problem.
- Solve N-Queens problem for n×n chessboard.
- Find all possible paths from top-left to bottom-right in a matrix.
Graph & Tree
- Count the number of connected components in a graph.
- Find the shortest path in an unweighted graph (BFS).
- Implement topological sort.
- Check if a binary tree is symmetric.
- Find the lowest common ancestor (LCA) of two nodes in a binary tree.
- Level order traversal of a binary tree.