All 155 questions

  1. Write a Two Sum function returning the matching indices, and explain its time complexity.

    Asked in 26 of 374 interviews · last asked Oct 23 · Write code · Junior

    Show answer

    Use a hash map to return the indices of two numbers whose sum equals the target. For each number, look for its complement, then store the number and its index. One pass takes O(n) time on average because hash-map operations take O(1) on average. Extra space is O(n).

    • The complement is the target minus the current number.
    • Check before storing so the same index is not used twice.
    • Duplicate values work when they occur at different indices.
    • Return one matching pair, or an empty list if no pair exists.
    Python
    def two_sum(nums, target):
        seen = {}
        for i, value in enumerate(nums):
            complement = target - value
            if complement in seen:
                return [seen[complement], i]
            seen[value] = i
        return []

    What the interviewer checks: The interviewer checks whether you can write correct code and explain how a hash map avoids checking every pair.

    Common mistake (in 7 of 10 reviewed answers): Many answers forget that the function must return two distinct indices, not the matching values.

    Other ways it was asked
    • “Write a function that solves the Two Sum problem.”
    • “What is the time complexity of a solution to the Two Sum problem?”
    • “What is the time complexity of your Two Sum solution?”
  2. Write a palindrome checker, and explain how to ignore case and non-alphanumeric characters.

    Asked in 13 of 374 interviews · last asked Oct 22 · Write code · Junior

    Show answer

    Keep only letters and numbers, make case differences irrelevant, and compare the result with its reverse. In Python, use casefold() to ignore case and isalnum() to filter characters. If the cleaned string equals its reverse, it is a palindrome.

    • This solution takes O(n) time and O(n) extra space.
    • Empty strings and strings with no letters or numbers count as palindromes.
    • Python's isalnum() accepts Unicode letters and numbers, not just ASCII.
    Python
    def is_palindrome(text: str) -> bool:
        cleaned = ''.join(char for char in text.casefold() if char.isalnum())
        return cleaned == cleaned[::-1]
    
    assert is_palindrome('A man, a plan, a canal: Panama!')
    assert not is_palindrome('hello')
    assert is_palindrome('!!!')

    What the interviewer checks: The interviewer is checking whether you can compare characters correctly, clean the input, and explain edge cases and cost.

    Other ways it was asked
    • “How would you check whether a string is a palindrome?”
    • “How can you identify whether a word is a palindrome?”
    • “Can you write code to determine whether a string is a palindrome?”
  3. Write code to reverse a string in place without allocating another array.

    Asked in 9 of 374 interviews · last asked Oct 12 · Write code · Junior

    Show answer

    Swap the first and last characters, then move inward until the pointers meet. Java strings are immutable, so true in-place reversal needs an existing mutable array, such as char[]. This code reverses that array without allocating another array.

    • Time is O(n), and extra space is O(1).
    • Empty arrays and single-character arrays stay unchanged.
    • Java char values are UTF-16 code units; reversing them can break surrogate pairs.
    Code
    class Solution {
        static void reverse(char[] chars) {
            int left = 0, right = chars.length - 1;
            while (left < right) {
                char temp = chars[left];
                chars[left++] = chars[right];
                chars[right--] = temp;
            }
        }
    }

    What the interviewer checks: The interviewer checks whether you can use two pointers, avoid extra storage, and recognize that Java strings are immutable.

    Other ways it was asked
    • “Write code to reverse a string.”
    • “Write Java code to reverse a string.”
    • “How would you write code to reverse a string?”
  4. Write code to find the largest number in an array.

    Asked in 6 of 374 interviews · last asked Oct 24 · Write code · Junior

    Show answer

    Scan the array once, keeping the largest value seen so far. Start with the first element so negative numbers work correctly. For an empty array, this function raises an error because there is no largest value.

    • One scan takes O(n) time and O(1) extra space.
    • Start with the first element, not zero.
    • Handle an empty array explicitly.
    Python
    def find_largest(numbers):
        if not numbers:
            raise ValueError("Array must not be empty")
        largest = numbers[0]
        for number in numbers:
            if number > largest:
                largest = number
        return largest

    What the interviewer checks: The interviewer checks whether you can scan an array, track a maximum, and handle edge cases.

    Other ways it was asked
    • “How would you find the maximum element in an array?”
    • “How would you find the maximum element in an array and count how many times it appears?”
    • “How would you find the largest number in a Java array?”
  5. Find the longest substring without repeated characters.

    Asked in 3 of 374 interviews · last asked Oct 7 · Write code · Junior

    Other ways it was asked
    • “Given a string, find the length of the longest substring without repeating characters.”
    • “How can you find the length of the longest substring without repeating characters without repeatedly scanning the substring?”
    • “Find the longest substring without repeating characters. Explain your approach.”
  6. What is an array?

    Asked in 3 of 374 interviews · last asked Oct 22 · Concept · Junior

    Other ways it was asked
    • “What is an array in programming?”
    • “Define an array.”
  7. Find the maximum contiguous subarray sum in one pass and explain the time complexity.

    Asked in 2 of 374 interviews · last asked Sep 10 · Write code · Mid-level

    Other ways it was asked
    • “How would you implement an algorithm to find the maximum subarray sum?”
    • “How can you optimize an algorithm for finding the maximum subarray sum?”
    • “How can you optimize an algorithm for finding the maximum subarray sum to run in O(n) time?”
  8. Given existing conference room bookings as an array of start- and end-time pairs and a new meeting request in the same format, write a function that determines whether the new meeting can be booked without overlapping any existing meeting.

    Asked in 2 of 374 interviews · last asked Jun 23 · Write code · Junior

    Other ways it was asked
    • “Given a list of existing conference-room bookings, each represented by a start time and an end time, and one new meeting request in the same format, write a function that returns true if the new meeting can be booked without overlapping any existing meeting, and false otherwise. Assume one meeting ending exactly when another starts is allowed.”
  9. What is the three-sum problem, and how would you solve it?

    Asked in 2 of 374 interviews · last asked Sep 5 · Write code · Junior

    Other ways it was asked
    • “How would you implement a solution to the three-sum problem?”
    • “What is the 3Sum problem?”
  10. How would you find the first non-repeating character in a string?

    Asked in 2 of 374 interviews · last asked Sep 21 · Write code · Mid-level

    Other ways it was asked
    • “Write a function that returns the first non-repeating character in a string.”
  11. Write Python code to count the frequency of each character in a user-provided name.

    Asked in 2 of 374 interviews · last asked Sep 18 · Write code · Junior

    Other ways it was asked
    • “Write a Python program to count the frequency of each character in a string.”
  12. Write code to find the second-largest element in an array without sorting.

    Asked in 2 of 374 interviews · last asked Sep 18 · Write code · Mid-level

    Other ways it was asked
    • “How can you find the second-largest element in an array without using a sorting function?”
    • “What is another approach to finding the second-largest element in an array?”
    • “Find the second largest element in the array. Can you write a Python program?”
  13. What should a maximum-subarray-sum function return when every number is negative?

    Asked in 2 of 374 interviews · last asked Sep 10 · Concept · Mid-level

    Other ways it was asked
    • “How would you find the maximum-sum contiguous subarray when the array may contain negative numbers?”
    • “What should the maximum subarray sum be when all the numbers are negative?”
    • “If the array contains only negative numbers, such as [-5, -2, -8], what should the function return?”
  14. Can an array contain values of different data types?

    Asked in 2 of 374 interviews · last asked Aug 27 · Concept · Junior

    Other ways it was asked
    • “Can an array store values of any type?”
  15. What is a palindrome?

    Asked in 2 of 374 interviews · last asked Oct 5 · Concept · Junior

  16. What is the two-pointer approach?

    Asked in 2 of 374 interviews · last asked Sep 10 · Concept · Junior

    Other ways it was asked
    • “How does the two-pointer technique work, and when would you use it?”
  17. Given an array containing only zeros and ones, how would you find the maximum distance between two ones?

    Asked once · last asked Aug 22 · Write code · Junior

  18. How would you find the first non-repeating element in an integer array?

    Asked once · last asked Sep 9 · Write code · Junior

    Other ways it was asked
    • “How would you find the first non-repeating element in an integer array, which data structure would you use, and what is the time complexity?”
    • “How would you find the first non-repeating element in an integer array when memory is limited?”
  19. What loop invariant does a two-pointer algorithm maintain when partitioning an array of zeros and ones?

    Asked once · last asked Sep 10 · Concept · Mid-level

  20. Write five test cases for a function that returns the second-largest element of an integer array.

    Asked once · last asked Jun 26 · Scenario · Junior

    Other ways it was asked
    • “How would you execute test cases for a function that returns the second-largest element of an integer array?”
  21. How does the conversion logic represent 90 as XC in Roman numerals?

    Asked once · last asked Aug 31 · Write code · Junior

    Other ways it was asked
    • “How does the algorithm generate XC when converting 90 to a Roman numeral?”
  22. Use prefix products to compute each array element's product except itself, without division.

    Asked once · last asked Sep 10 · Write code · Mid-level

    Other ways it was asked
    • “How would you find the product of all the other elements for each position in an array, without using division?”
    • “What is the reasoning behind using prefix products in your approach, and how does it help solve the problem without division?”
  23. How should a product-of-array-except-self algorithm handle arrays containing one zero or two zeros?

    Asked once · last asked Sep 10 · Scenario · Mid-level

    Other ways it was asked
    • “How should a product-of-array-except-self algorithm handle negative numbers, empty or single-element arrays, and possible overflow with large values?”
  24. What is the space complexity of a product-of-array-except-self algorithm if the output array is not counted?

    Asked once · last asked Sep 10 · Concept · Mid-level

  25. How would you convert a Roman numeral string to an integer?

    Asked once · last asked Oct 19 · Write code · Junior

    Other ways it was asked
    • “How would you convert an integer to a Roman numeral string?”
  26. Write a program using for loops to count each distinct character in a string and display each character with its count only once (for example, a=2, j=1, e=3).

    Asked once · last asked Feb 7 · Write code · Junior

  27. Given a list of integers, how would you find the first non-repeating element in Python?

    Asked once · last asked Mar 19 · Write code · Mid-level

  28. What is the time complexity of finding the first non-repeating integer in a list?

    Asked once · last asked Mar 19 · Concept · Mid-level

  29. Given a string, how would you convert it into an array, count each item's occurrences, and find the most frequent item?

    Asked once · last asked Sep 11 · Write code · Junior

  30. Write Python code to extract every string from a tuple, count the occurrences of each character, and return a dictionary with each character as a key and its count as the value.

    Asked once · last asked Apr 22 · Write code · Junior

  31. Write a program to display each character in a string along with its frequency.

    Asked once · last asked Apr 24 · Write code · Junior

  32. Write a function that takes an array of numbers and returns only the even numbers.

    Asked once · last asked May 23 · Write code · Junior

  33. How can you efficiently compare two arrays in Power Automate or with an external approach?

    Asked once · last asked Jun 9 · Scenario · Senior

  34. Write code that takes a list of numbers and prints the largest and second-largest numbers.

    Asked once · last asked Jun 11 · Write code · Junior

  35. How would you handle duplicate values when finding the largest and second-largest numbers in a list?

    Asked once · last asked Jun 11 · Scenario · Junior

    Other ways it was asked
    • “How would your solution handle duplicate values when finding the largest and second-largest numbers in a list?”
  36. Write a program to find a character that appears only once in a string.

    Asked once · last asked Jun 20 · Write code · Junior

  37. Write a C++ function that takes an array of integers (each between -1,000,000 and 1,000,000, with at most 10,000 elements) and returns the second-largest element, or “not found” if there is no second-largest element.

    Asked once · last asked Jun 26 · Write code · Junior

  38. Write a Python function that takes a list of integers and a target sum, and returns all unique pairs that add up to the target without using external libraries, efficiently for large lists.

    Asked once · last asked Jul 16 · Write code · Mid-level

  39. How would you solve the palindrome problem using a brute-force approach?

    Asked once · last asked Jul 16 · Write code · Junior

  40. When checking an odd-length string for a palindrome, should an unmatched middle character make it fail?

    Asked once · last asked Jul 16 · Concept · Junior

  41. How would you approach solving the problem of removing duplicates from a sorted list?

    Asked once · last asked Jul 10 · Write code · Junior

  42. Write pseudocode for two players taking turns scanning a string, one owning r and the other m: upon encountering their character, they score its current zero-based position, delete it, and restart counting from zero in the remaining string.

    Asked once · last asked Nov 17 · Write code · Junior

    Other ways it was asked
    • “Write pseudocode for a two-player game where one player scores when they encounter r and the other scores when they encounter m in a string. Each scores the points for the character's current position, removes that character, and restarts the position count from zero for the remaining string. How would you implement the game?”
  43. Write code to determine whether a string is a palindrome using the two-pointer approach.

    Asked once · last asked Jul 16 · Write code · Junior

  44. Given a list of words and a maximum character length per line, how would you write the function to build lines joined by dashes?

    Asked once · last asked Jul 22 · Write code · Junior

  45. Can you walk me through your approach to implementing the text reflow or justification logic?

    Asked once · last asked Jul 22 · Scenario · Junior

  46. How do you decide how many spaces to add when justifying text?

    Asked once · last asked Jul 22 · Concept · Junior

  47. Can you write a Java program for swapping numbers in an array?

    Asked once · last asked Jul 22 · Write code · Junior

  48. Given an array of integers, write a function that returns the second largest unique number in the array, or minus one if it doesn’t exist. Please explain your approach before coding.

    Asked once · last asked Jul 28 · Write code · Junior

  49. Given an array of intervals, how would you merge all overlapping intervals?

    Asked once · last asked Jul 28 · Write code · Junior

  50. Write C++ code to find a palindrome in a stream.

    Asked once · last asked Aug 7 · Write code · Junior

  51. What is a sparse matrix, and why is a standard matrix representation inefficient when most values are zero?

    Asked once · last asked Aug 10 · Concept · Junior

  52. How would you add diagonal win detection to a tic-tac-toe game?

    Asked once · last asked Aug 12 · Write code · Mid-level

  53. Given two lists of numbers from 1 to 100, where one list is missing a number, how would you find the missing number?

    Asked once · last asked Aug 13 · Write code · Junior

  54. What is the difference between an array and a vector?

    Asked once · last asked Dec 6 · Concept · Junior

  55. What is the time complexity of accessing an element in an array or vector?

    Asked once · last asked Dec 6 · Concept · Junior

  56. Write a function that returns a Boolean value indicating whether a string has eight or more characters.

    Asked once · last asked Aug 21 · Write code · Junior

  57. Write `normalize_transcript` to prepare raw ASR output for scoring: lowercase text, expand contractions (don't → do not, can't → cannot, I'm → i am), remove punctuation except intraword apostrophes, collapse consecutive spaces, and trim leading and trailing spaces.

    Asked once · last asked Aug 26 · Write code · Junior

    Other ways it was asked
    • “Write a function, `normalize_transcript`, that prepares raw ASR output for scoring. It should lowercase everything, expand a small set of contractions (such as “don't” to “do not,” “can't” to “cannot,” and “I'm” to “I am”), remove punctuation except apostrophes inside words, collapse multiple spaces into one, and strip leading and trailing spaces.”
  58. Write `chunk_audio` to split a long audio array into overlapping chunks for model input, using `chunk_size` and `overlap`. Keep the final chunk even if shorter than `chunk_size`, without padding. Raise `ValueError` if `overlap` exceeds `chunk_size`.

    Asked once · last asked Aug 26 · Write code · Junior

    Other ways it was asked
    • “Write a function, `chunk_audio`, that splits a long audio array into overlapping chunks before they are fed into a model. The last chunk may be shorter than `chunk_size`; do not drop or pad it. Raise a `ValueError` if `overlap` is greater than `chunk_size`.”
  59. What condition would you write to compare each array element with the current maximum while counting occurrences?

    Asked once · last asked Aug 27 · Write code · Junior

  60. How would you merge consecutive turns from the same speaker in diarized transcript data?

    Asked once · last asked Aug 28 · Write code · Mid-level

  61. How would you represent a 100-by-100 Minesweeper board in the program?

    Asked once · last asked Aug 28 · Concept · Junior

  62. What is Kadane's algorithm, and how does it find a maximum-sum contiguous subarray?

    Asked once · last asked Sep 4 · Concept · Junior

  63. You have an array of integers containing positive and negative numbers; rearrange it so all positive numbers appear before all negative numbers, while maintaining the relative order. Can you solve it?

    Asked once · last asked Sep 4 · Write code · Mid-level

  64. Given arrays of available ingredient quantities and amounts required per cookie, how many cookies can you make?

    Asked once · last asked Sep 5 · Write code · Junior

  65. Implement a solution to the 3Sum problem.

    Asked once · last asked Sep 5 · Write code · Junior

  66. Write code for the four-sum problem in Java.

    Asked once · last asked Sep 6 · Write code · Junior

  67. Solve the LeetCode 3Sum problem.

    Asked once · last asked Sep 6 · Write code · Junior

  68. How would you track character counts to determine whether two strings are anagrams?

    Asked once · last asked Sep 8 · Write code · Junior

  69. What is the time complexity of sorting each string and grouping the anagrams?

    Asked once · last asked Sep 8 · Concept · Junior

  70. How could you further optimize your solution for grouping anagrams?

    Asked once · last asked Sep 8 · Write code · Mid-level

  71. What test cases would you use to verify a solution that groups anagrams?

    Asked once · last asked Sep 8 · Write code · Junior

  72. Given an array of integers, find the length of the longest contiguous subarray whose sum is equal to k.

    Asked once · last asked Sep 9 · Write code · Mid-level

  73. Given an integer array and a target k, can you find the length of the longest contiguous subarray with sum k in O(n) time?

    Asked once · last asked Sep 9 · Write code · Mid-level

    Other ways it was asked
    • “Can you solve the longest subarray sum problem in O(n) time?”
  74. Given an array of integers, return the k most frequent elements.

    Asked once · last asked Sep 9 · Write code · Mid-level

  75. How can you improve the time complexity of finding the k most frequent elements in an array?

    Asked once · last asked Sep 9 · Write code · Mid-level

  76. What are the drawbacks of sorting an integer array to find its first non-repeating element?

    Asked once · last asked Sep 9 · Concept · Mid-level

  77. Describe the steps and logic to rearrange an array of zeros and ones in place, with all zeros on the left and ones on the right.

    Asked once · last asked Sep 10 · Write code · Junior

  78. How should an in-place algorithm for partitioning zeros and ones handle input values other than zero or one?

    Asked once · last asked Sep 10 · Scenario · Mid-level

  79. How would you modify a maximum-subarray function to return the start and end indices of the subarray with the largest sum?

    Asked once · last asked Sep 10 · Write code · Mid-level

  80. What should a maximum-subarray function return for the input [-1, 0, -2]?

    Asked once · last asked Sep 10 · Write code · Mid-level

  81. How would you solve the two-sum problem when the input array is sorted and you cannot use a HashMap?

    Asked once · last asked Sep 10 · Write code · Junior

    Other ways it was asked
    • “How would you solve the two-sum problem in O(n) time without using a HashMap?”
  82. Why does the two-pointer solution for a sorted-array two-sum problem start with pointers at opposite ends of the array?

    Asked once · last asked Sep 10 · Concept · Junior

  83. In the sorted-array two-sum problem, if the first number is -5 and the last number is 13, what would you do first?

    Asked once · last asked Sep 10 · Write code · Junior

  84. How would you find the two most frequent elements in an array of n numbers when k = 2?

    Asked once · last asked Sep 10 · Write code · Junior

  85. Write JavaScript code that returns the first repeating character in a string.

    Asked once · last asked Sep 11 · Write code · Junior

  86. Can you implement code to determine which of two players has the stronger five-number combination? Compare how often values occur, and when the frequency patterns tie, compare the values in those groups to decide the winner.

    Asked once · last asked Sep 13 · Write code · Junior

  87. Can you write a function to move all zeros to the beginning of an array while keeping the order of non-zero elements?

    Asked once · last asked Sep 15 · Write code · Junior

  88. Given an array like 2, 3, 1, 2, 2, 4, 3 and target 7, find the length of the smallest contiguous subarray whose sum is at least the target, then explain the approach and time and space complexity.

    Asked once · last asked Sep 22 · Write code · Junior

  89. How does allowing negative numbers in the array change the approach to finding the smallest contiguous subarray with a sum at least the target?

    Asked once · last asked Sep 22 · Concept · Mid-level

  90. Given an array, write a function that returns an array where each element is the product of every input element except itself.

    Asked once · last asked Sep 24 · Write code · Junior

  91. Can you implement an efficient Dart function to reverse a word without using split, reverse, or join?

    Asked once · last asked Sep 24 · Write code · Junior

  92. Write a function to check for a palindrome in JavaScript.

    Asked once · last asked Oct 5 · Write code · Junior

  93. How would you use nested loops to scan substrings, and how would you manage the indices?

    Asked once · last asked Oct 10 · Write code · Junior

  94. How would you test a password substring search against examples, such as checking whether “tea makes me happy” contains “happy”?

    Asked once · last asked Oct 10 · Write code · Junior

  95. After resolving compilation and variable-scope issues in a nested-loop substring search, what would you improve in the solution's structure?

    Asked once · last asked Oct 10 · Write code · Junior

  96. How would you find the second-largest distinct value in one single pass without sorting, and what should your approach do if the list is empty or has only one distinct value?

    Asked once · last asked Oct 12 · Write code · Junior

  97. Write complete C++ code to count subarrays whose sums are divisible by k.

    Asked once · last asked Oct 15 · Write code · Mid-level

  98. When normalizing a possibly negative remainder in the subarrays-divisible-by-k algorithm, should you divide by k or apply modulo k again?

    Asked once · last asked Oct 15 · Concept · Junior

  99. What is the time and space complexity of the prefix-sum algorithm for counting subarrays whose sums are divisible by k?

    Asked once · last asked Oct 15 · Concept · Mid-level

  100. What core test cases would you include to validate correctness and edge conditions when merging two sorted integer arrays?

    Asked once · last asked Oct 20 · Scenario · Junior

  101. When reviewing an implementation that merges two sorted arrays, what common bug patterns would you look for, and which tests would catch each one?

    Asked once · last asked Oct 20 · Scenario · Mid-level

  102. Where would you normalize a string in a palindrome-checking solution so that "Radar" is recognized as a palindrome?

    Asked once · last asked Oct 22 · Write code · Junior

  103. How could you use Python's `isalpha()` method to normalize a string for palindrome checking?

    Asked once · last asked Oct 22 · Write code · Junior

  104. Find the second-largest distinct number in the list [10, 25, 8, 25, 18, 30].

    Asked once · last asked Oct 23 · Write code · Junior

  105. Write code that reverses each word in a sentence while keeping the word order—for example, transform “Java is fun” into “avaJ si nuf.”

    Asked once · last asked Jan 25 · Write code · Junior

  106. In prefix-sum subarray algorithms, when is it useful to initialize the frequency of a prefix sum of 0 to 1?

    Asked once · last asked Oct 15 · Concept · Junior

    Other ways it was asked
    • “Why do prefix-sum subarray algorithms initialize the frequency of a prefix sum of 0 to 1?”
    • “Can you give an example of a prefix-sum subarray problem where initializing the frequency of a prefix sum of 0 to 1 is necessary?”
  107. What property of a word makes it a palindrome?

    Asked once · last asked Jul 16 · Concept · Junior

    Other ways it was asked
    • “What property of a string makes it a palindrome?”
  108. What is the space complexity of your two-sum solution?

    Asked once · last asked Sep 10 · Concept · Junior

  109. How would you implement a method that adds two strings?

    Asked once · last asked Apr 20 · Write code · Junior

    Other ways it was asked
    • “How would you overload a method to add two strings?”
  110. Why does the two-pointer approach work for removing duplicates?

    Asked once · last asked Aug 8 · Concept · Junior

    Other ways it was asked
    • “How does the two-pointer approach remove duplicates?”
    • “Why does a pointer move only forward in the two-pointer approach for removing duplicates?”
    • “What is the time complexity of using the two-pointer approach to remove duplicates?”
  111. How would you approach solving the Two Sum problem and running your solution?

    Asked once · last asked Aug 19 · Write code · Junior

  112. When scanning an array for its maximum value and frequency, what should happen to the count when you find a new maximum?

    Asked once · last asked Aug 27 · Concept · Junior

  113. What condition should you use to detect a new maximum while scanning an array?

    Asked once · last asked Aug 27 · Write code · Junior

    Other ways it was asked
    • “What condition should you use to detect another occurrence of the current maximum in an array?”
  114. When finding the maximum value and its frequency in an array, should you use an else-if branch or an else branch?

    Asked once · last asked Aug 27 · Write code · Junior

  115. How should an in-place algorithm for moving zeros to the left and ones to the right handle an empty array?

    Asked once · last asked Sep 10 · Scenario · Junior

    Other ways it was asked
    • “How should an in-place algorithm for moving zeros to the left and ones to the right handle an already partitioned array or an array whose values are all the same?”
  116. What is an array, and how are its elements organized?

    Asked once · last asked Mar 31 · Concept · Junior

  117. Can you define a string?

    Asked once · last asked Apr 24 · Concept · Junior

  118. What error handling would you add to a function that finds the largest number in an array?

    Asked once · last asked May 22 · Scenario · Junior

  119. Can you explain the purpose of a function that filters even numbers from an array and how it works?

    Asked once · last asked May 23 · Write code · Junior

  120. How would you write a string-reversal function in Go, and how would it work?

    Asked once · last asked Jun 9 · Concept · Junior

    Other ways it was asked
    • “Can you explain how your Go string-reversal function works?”
  121. Given a list of strings, find the longest common prefix.

    Asked once · last asked Jun 29 · Write code · Junior

  122. What is the difference between a sparse matrix and a dense matrix?

    Asked once · last asked Nov 20 · Concept · Junior

  123. Write a program to check whether a given string matches a specified pattern.

    Asked once · last asked Jul 17 · Write code · Junior

  124. Before you start coding, can you explain your approach to the text reflow problem?

    Asked once · last asked Jul 22 · Scenario · Junior

  125. How should a text reflow algorithm handle words from multiple sentences?

    Asked once · last asked Jul 22 · Scenario · Junior

  126. Given a list of numbers and a target, can you write code to find two numbers in the list whose sum equals the target?

    Asked once · last asked Aug 10 · Write code · Junior

  127. How do you reverse an array in code?

    Asked once · last asked Aug 12 · Write code · Junior

  128. Write a program to reverse an array without using an inbuilt function.

    Asked once · last asked Aug 12 · Write code · Junior

  129. How would you orient the printed game board so its bottom row appears at the bottom, as on a physical board?

    Asked once · last asked Aug 12 · Write code · Junior

  130. What are the uses of vectors in programming?

    Asked once · last asked Aug 26 · Concept · Junior

  131. What is a vector data type in programming?

    Asked once · last asked Aug 26 · Concept · Junior

  132. What value would you initialize as the current maximum when finding the largest element in an array?

    Asked once · last asked Aug 27 · Write code · Junior

  133. How should a function that merges consecutive speaker turns handle an empty input list?

    Asked once · last asked Aug 28 · Scenario · Mid-level

  134. How would you approach finding the second highest number from a list of integers in Python?

    Asked once · last asked Sep 1 · Write code · Junior

  135. Given the sequence [1, 2, 3, 4, 5, 6, 5, 7], find the missing number in the range 1 to 8.

    Asked once · last asked Sep 3 · Write code · Junior

    Other ways it was asked
    • “Given the sequence 12345657, find the missing number in the range 1 to 8.”
  136. How would you count the frequency of each character in a string?

    Asked once · last asked Sep 5 · Write code · Junior

    Other ways it was asked
    • “How would you count the frequency of each character in a string using a dictionary?”
  137. Why would you use the short type to store character counts when grouping anagrams?

    Asked once · last asked Sep 8 · Concept · Junior

  138. For an algorithm that partitions an array of zeros and ones, would you validate the input or assume it is always valid?

    Asked once · last asked Sep 10 · Scenario · Mid-level

  139. How should a maximum-subarray function handle an empty input array?

    Asked once · last asked Sep 10 · Scenario · Mid-level

  140. What edge cases should a maximum-subarray implementation handle?

    Asked once · last asked Sep 10 · Scenario · Mid-level

  141. Reverse a string in Python without using any built-in reverse function.

    Asked once · last asked Sep 10 · Write code · Junior

    Other ways it was asked
    • “Reverse this string without using any built-in reverse function in Python.”
  142. Can you write pseudocode for the two-sum problem?

    Asked once · last asked Sep 10 · Write code · Junior

  143. What is the time complexity of solving the two-sum problem with a sorted array and no HashMap?

    Asked once · last asked Sep 10 · Write code · Junior

  144. What could make a proposed solution to the two-sum problem incorrect?

    Asked once · last asked Sep 10 · Scenario · Junior

  145. What is a subsequence?

    Asked once · last asked Sep 10 · Concept · Junior

  146. Can you write a Python program to reverse a string?

    Asked once · last asked Sep 14 · Write code · Junior

    Other ways it was asked
    • “Can you write a Python program to reverse a string, using “Arjun” as the example?”
  147. Can you write a function to count palindromes in a string?

    Asked once · last asked Sep 15 · Write code · Junior

  148. How would you assign a long or short label to each word in a list?

    Asked once · last asked Sep 17 · Write code · Junior

  149. What is a string?

    Asked once · last asked Oct 4 · Concept · Junior

  150. How is a string represented in code?

    Asked once · last asked Oct 4 · Concept · Junior

  151. How would you calculate the sum of two sorted arrays?

    Asked once · last asked Oct 4 · Write code · Junior

  152. What is an array, and how does an array collection work?

    Asked once · last asked Oct 5 · Concept · Junior

  153. What are practical use cases and applications of palindromes?

    Asked once · last asked Oct 5 · Concept · Junior

  154. In a prefix-sum array, what does pref[i] represent?

    Asked once · last asked Oct 15 · Concept · Junior

  155. Where would you convert a string to lowercase in a palindrome-checking solution?

    Asked once · last asked Oct 22 · Write code · Junior

    Other ways it was asked
    • “What is the Python syntax for converting a string to lowercase, and where would you use it in a palindrome-checking solution?”

More Data Structures and Algorithms interview questions

How this list is made

Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.

Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.

The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every Data Structures and Algorithms interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.

374 interviews, 269 candidates, Sep 2025 to Oct 2026. Updated every month with new interviews.