Array Coding and Data Structures Interview Questions with Solution

 In this post, i am going to add some most frequent asked array questions in any coding interview, While preparing my upcoming coding interview exam, i found on many website that these question are reference their. 

I also got in experience that whenever we are attend any problem solving round or coding round most of interviewer start with array based question, so they can check that how good we are in terms of basic or fundamentals of data-structure.

I am going to use golang for solving these question and will share my answer with brief logic, so its help you and me (in case if these need me in future for further preparation).

If you have solution for this question or you have question which you want me to add here,post in comment or feel free to email me so i can it here.

ds interview

Array Coding and Data Structures Interview Questions:


  1. How do you find the missing number in a given integer array of 1 to 100? (Golang solution)
  2. How do you find the duplicate number on a given integer array? (Golang solution)
  3. How do you find the largest and smallest number in an unsorted integer array? (Golang solution)
  4. How do you find all pairs of an integer array whose sum is equal to a given number? (Golang solution)
  5. How do you find duplicate numbers in an array if it contains multiple duplicates? (Golang solution)
  6. How are duplicates removed from a given array in  golang? (Golang solution)
  7. How is an integer array sorted in place using the quicksort algorithm? (Golang solution)
  8. How do you remove duplicates from an array in place? (Golang solution)
  9. How do you reverse an array in place in Golang? (solution)
  10. How are duplicates removed from an array without using any library? (Golang solution).
  11. Peak Element (Python solution)
  12. Find the minimum and maximum element in an array using golang (solution)
  13. Write a program to reverse the array using golang (solution)
  14. Write a program to sort the given array using golang (solution)
  15. Find the Kth largest and Kth smallest number in an array using golang (solution)
  16. Find the occurrence of an integer in the array using golang (solution)
  17. Sort the array of 0s, 1s, and 2s using golang (solution)
  18. Subarray with given Sum using golang (solution)
  19. Move all the negative elements to one side of the array using golang (solution)
  20. Find the Union and Intersection of the two sorted arrays using golang (solution)
  21. Write a program to cyclically rotate an array by one  using golang (solution)
  22. Find the missing integer using golang (solution)
  23. Count Pairs with given sum using golang (solution)
  24. Find duplicates in an array using golang (solution)
  25. Sort an Array using Quicksort algorithm using golang (solution)
  26. Find common elements in three sorted arrays using golang (solution)
  27. Find the first repeating element in an array of integers using golang (solution)
  28. Find the first non-repeating element in a given array of integers using golang (solution)
  29. Subarrays with equal 1s and 0s using golang (solution)
  30. Rearrange the array in alternating positive and negative items using golang (solution)
  31. Find if there is any subarray with sum equal to zero using golang (solution)
  32. Find Largest sum contiguous Subarray using golang (solution)
  33. Find the factorial of a large number using golang (solution)
  34. Find Maximum Product Subarray using golang (solution)
  35. Find longest consecutive subsequence using golang (solution)
  36. Find the minimum element in a rotated and sorted array using golang (solution)
  37. Max sum in the configuration using golang (solution)
  38. Minimum Platforms using golang (solution)
  39. Minimize the maximum difference between the heights using golang (solution)
  40. Minimum number of Jumps to reach end using golang (solution)
  41. Stock Span problem using golang (solution)
  42. Find a triplet that sum to a given value using golang (solution)
  43. Smallest positive missing number using golang (solution)
  44. Find the row with maximum number of 1’s using golang (solution)
  45. Print the matrix in a Spiral manner using golang (solution)
  46. Find whether an array is a subset of another array using golang (solution)
  47. Implement two Stacks in an array using golang (solution)
  48. Majority Element using golang (solution)
  49. Wave Array using golang (solution)
  50. Trapping Rain water using golang (solution)
  51. Smallest Positive integer that can’t be represented as a sum     using golang (solution)
  52. Maximum Index using golang (solution)
  53. Max sum path in two arrays using golang (solution)
  54. Find Missing And Repeating using golang (solution)
  55. Stock buy and sell Problem using golang (solution)
  56. Pair with given sum in a sorted array using golang (solution)
  57. Chocolate Distribution Problem using golang (solution)
  58. Longest Consecutive Subsequence using golang (solution)
  59. Coin Change Problem using golang (solution)
  60. Longest Alternating sub-sequence using golang (solution)    

I will solve these question one by one and posted their solution with full explanation (based on my understanding), you can review my code and let me know if something wrong.

Post a Comment