All 67 questions

  1. What is the difference between an array and a linked list?

    Asked in 6 of 374 interviews · last asked Sep 30 · Concept · Junior

    Show answer

    An array stores elements in one continuous memory block. A linked list stores nodes connected by links, which may be scattered in memory. Array access by index is O(1); linked list access by index is O(n). Python's built-in list is a dynamic array, not a linked list.

    • Array insertion or deletion can take O(n) because elements may need to shift.
    • Linked list insertion or deletion is O(1) with the required node and predecessor references; finding them takes O(n).
    • Linked lists need extra memory for links; arrays usually make better use of CPU caches.

    What the interviewer checks: The interviewer checks whether you understand memory layout, access speed, update costs, and language-specific naming.

    Other ways it was asked
    • “What is the difference between an array and a list?”
    • “What is the difference between a list and an array in Python?”
  2. What are the differences between ArrayList and LinkedList in Java?

    Asked in 6 of 374 interviews · last asked Oct 16 · Concept · Junior

    Show answer

    ArrayList uses a resizable array, while LinkedList uses a doubly linked list. Both implement Java's List interface. ArrayList provides O(1) access by index, while LinkedList takes O(n). ArrayList shifts elements for middle insertions or removals; LinkedList changes links in O(1), but finding the position takes O(n).

    • ArrayList appends take O(1) amortized time; resizing can take O(n).
    • LinkedList adds or removes elements at either end in O(1) and also implements Deque.
    • An already-positioned LinkedList ListIterator can insert or remove in O(1).
    • ArrayList usually uses less memory and is faster to iterate because its storage is more compact.

    What the interviewer checks: The interviewer checks whether you can connect each internal structure to its performance and choose the right list.

    Other ways it was asked
    • “What is the difference between ArrayList and LinkedList?”
    • “What is the difference between Java's ArrayList and LinkedList?”
    • “What is the difference between the List interface and LinkedList in Java?”
  3. What is a linked list?

    Asked in 5 of 374 interviews · last asked Sep 13 · Concept · Junior

    Show answer

    A linked list is a sequence of nodes, where each node stores data and a link to the next node. The nodes do not need to sit next to each other in memory. You start at the head and follow links to reach other nodes. A doubly linked list also links each node to the previous node.

    • Access by position takes O(n) time because you must follow links.
    • Insertion or deletion takes O(1) once you have the needed node references; finding them can take O(n).
    • Links use extra memory compared with an array.
    • An empty list has no data nodes; a non-circular list usually ends with a null link.
    Code
    head → [10] → [20] → [30] → null

    What the interviewer checks: The interviewer checks whether you understand nodes, links, traversal, and the basic trade-offs compared with arrays.

    Other ways it was asked
    • “Can you explain a linked list?”
    • “What is a linked list, and how does it work?”
    • “How does a linked list work?”
  4. What is the difference between an array and an ArrayList?

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

    Show answer

    In Java, an array has a fixed length, while an ArrayList can grow or shrink as elements are added or removed. Arrays can hold primitive values or objects, but ArrayList holds only objects, using wrapper types for primitives. List is an interface; ArrayList is one implementation of it.

    • Both provide constant-time access by index.
    • Arrays use length; ArrayList uses size() to report the number of elements.
    • ArrayList uses an internal array and may copy elements when it needs more capacity.
    • Inserting or removing elements in the middle of an ArrayList requires shifting elements.

    What the interviewer checks: The interviewer checks whether you understand size limits, supported types, and the difference between an interface and its implementation.

    Other ways it was asked
    • “What is the difference between ArrayList and List in Java?”
    • “How is an array different from an ArrayList?”
  5. In Java, how does an ArrayList grow internally when it runs out of capacity, and what happens to existing elements during that growth?

    Asked in 4 of 374 interviews · last asked Oct 22 · Concept · Mid-level

    Show answer

    When an ArrayList fills up, it allocates a larger backing array and copies existing element references into it. In current OpenJDK, growth is usually about 1.5 times the old capacity. Growth does not clone objects or change their order or indices. A no-argument ArrayList starts empty and normally allocates capacity 10 on its first add.

    • The exact growth policy depends on the implementation and version; Java does not guarantee a growth factor.
    • A growth operation takes O(n) time because it copies existing references.
    • Appending takes amortized O(1) time across many additions.
    • Capacity is the backing array length; size is the number of stored elements.

    What the interviewer checks: The interviewer checks whether you understand array resizing, reference copying, and the cost of appending.

    Other ways it was asked
    • “In Java, when an ArrayList grows past capacity, what happens to its backing storage and what does that imply for existing element references and indices?”
    • “In Java, what happens internally when you add an element to an ArrayList beyond its current capacity? How is the backing array resized, and how are existing elements moved?”
    • “What is the default capacity of a Java ArrayList, and how does it grow when you add more elements?”
  6. Write code to check whether parentheses are valid.

    Asked in 2 of 374 interviews · last asked Oct 20 · Write code · Junior

    Other ways it was asked
    • “What test cases would you write to ensure a function that checks whether parentheses are valid, including nested parentheses, is correct and robust?”
    • “How would you structure a function that checks whether parentheses are valid, and what should it do when it encounters a closing bracket that does not match the expected type?”
  7. How does an algorithm reverse a linked list?

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

    Other ways it was asked
    • “How would you reverse a linked list?”
  8. Can you explain the difference between a stack and a queue, and give a real-world example of each?

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

    Other ways it was asked
    • “What's the difference between a stack and a queue, and when would you choose each?”
  9. How do Python lists differ from arrays in whether they can hold values of different types?

    Asked once · last asked Mar 31 · Concept · Junior

    Other ways it was asked
    • “Why can Python lists contain values of different types?”
  10. In a stack, what is the difference between peek and pop?

    Asked once · last asked Apr 9 · Concept · Junior

  11. Given a pile of cards represented as strings, implement a shuffle that moves the top card to a second pile, then repeatedly places subsequent cards alternately under and on top of the second pile until the first pile is empty.

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

    Other ways it was asked
    • “Given an initial pile of cards represented as strings, how would you implement this shuffle: move the top card to a second pile, then repeatedly place the next card alternately under and on top of the second pile until the first pile is empty?”
  12. In what situations would you create a custom iterator?

    Asked once · last asked May 25 · Concept · Mid-level

  13. What are the benefits of using an ArrayList instead of a linked list for searching, and how would you justify that choice?

    Asked once · last asked Nov 17 · Concept · Junior

  14. How is a LinkedList implemented internally in Java?

    Asked once · last asked Jul 16 · Concept · Mid-level

  15. Could you implement a stack in Java?

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

  16. How can you implement a queue using an array, and what are its strengths and limitations?

    Asked once · last asked Aug 10 · Concept · Junior

  17. Given an array of strings representing a valid arithmetic expression in Reverse Polish notation, evaluate the expression and return the result. The operands may be integers or results of other operations; the operators are addition, subtraction, multiplication, and division, with integer division truncating toward zero.

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

  18. Write a C++ program that takes 10 random numbers, stores them in a linked list, and prints them.

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

  19. If you implement a stack using an array, what do you do when it runs out of capacity?

    Asked once · last asked Aug 14 · Scenario · Junior

  20. If you need to implement a LIFO undo feature in Python, which built-in structure would you use and what operations would you rely on?

    Asked once · last asked Aug 16 · Concept · Junior

  21. In a bracket-matching algorithm, what does `last` refer to, and what does `stack[stack.length - 1]` access?

    Asked once · last asked Aug 31 · Concept · Junior

  22. Why does a bracket-matching algorithm continue to the next iteration after it encounters an opening bracket?

    Asked once · last asked Aug 31 · Concept · Junior

  23. Create a linked list and show me the reversed linked list.

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

  24. How would you merge two sorted linked lists and return a new sorted list?

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

  25. What are the time and space complexities of an algorithm that merges two sorted linked lists?

    Asked once · last asked Sep 5 · Concept · Junior

  26. How would you merge five or more sorted linked lists, and what data structure or algorithm would you use?

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

  27. Would you use recursion to merge two sorted linked lists, and how would it affect space complexity?

    Asked once · last asked Sep 5 · Concept · Junior

  28. Please create a linked list, add a few elements, and print all its elements.

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

  29. Write a function that determines whether a string containing parentheses, braces, and square brackets has valid, properly nested brackets.

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

  30. Should an algorithm for detecting redundant parentheses check whether the parentheses are balanced first, and how should it handle unbalanced input?

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

  31. How can you detect whether a pair of parentheses is redundant because it contains no operator?

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

  32. How would you handle nested parentheses when an inner pair is redundant but the outer pair is not?

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

  33. How would you extend a redundant-parentheses checker to handle square brackets and curly braces?

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

  34. How would you match each closing bracket to the correct opening bracket type and check for operators inside?

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

  35. How would you decide whether parentheses are redundant while accounting for operator precedence in expressions such as a + b and a + b + c?

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

  36. In Java, how do ArrayDeque and LinkedList compare as queues? How is ArrayDeque laid out in memory, and how does it handle wraparound as the head and tail move?

    Asked once · last asked Sep 11 · Concept · Senior

  37. In a doubly linked list, what pointers does each node store, and what pointer updates are needed to remove an arbitrary middle node?

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

  38. Could you explain how ArrayLists differ from arrays in terms of resizing or flexibility?

    Asked once · last asked Sep 12 · Concept · Junior

  39. What is the time-complexity difference between appending an item to a list and concatenating two lists?

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

  40. How will you traverse a linked list?

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

  41. Implement a restaurant waiting-line system with an enqueue function to add a party, a join function to let a late arrival find a friend and join their party, and a queue function to return the next party ready to be seated.

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

    Other ways it was asked
    • “Implement a restaurant waiting-line system with an enqueue function that adds a group of people to the line, a join function that lets a late arrival find a friend and join their party, and a queue function that returns the next party ready to be seated.”
  42. In C++, what are the differences between std::vector and std::deque, including memory layout and push/pop complexity at the front and back?

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

  43. What pointers do doubly linked list nodes store, and how can you reorder nodes without moving elements?

    Asked once · last asked Oct 4 · Concept · Junior

    Other ways it was asked
    • “In a doubly linked list, what pointers does each node typically store, and which operations can be done without moving existing nodes in memory?”
    • “In a doubly linked list, which operations can splice or reorder elements by only relinking pointers, with no element moves or copies, and what does that require about the nodes involved?”
  44. How is a queue typically implemented under the hood in C++, which underlying container does it use by default, and what property does that choice provide compared to using a dynamic array directly?

    Asked once · last asked Oct 4 · Concept · Junior

  45. What are the performance drawbacks of using a Python list to remove items from the front of a streaming-data queue and insert new items?

    Asked once · last asked Oct 6 · Concept · Junior

  46. How is a doubly linked list node laid out in memory, what references or fields does it store, and what extra overhead does it have compared with a dynamic array?

    Asked once · last asked Oct 13 · Concept · Senior

  47. In Java, what happens internally when you remove an element from the middle of an ArrayList? How are the remaining elements laid out afterward?

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

  48. In Java, how is a LinkedList node structured, what references does it hold, and what extra memory cost does that imply per element versus an ArrayList?

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

  49. How should a redundant-parentheses checker handle an empty pair of parentheses, such as ()?

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

    Other ways it was asked
    • “How should a redundant-parentheses checker handle an empty string or an expression with no parentheses?”
    • “How would you test a redundant-parentheses checker with nested parentheses, empty pairs, and different operator combinations?”
  50. What is a List data structure, and when would you use one?

    Asked once · last asked Mar 25 · Concept · Junior

  51. Is there a difference between a flat list of products and an array of products?

    Asked once · last asked Apr 28 · Concept · Junior

    Other ways it was asked
    • “What do you mean by “flat list” and “array of products”? Aren't they the same?”
  52. If I want to delete the last element from a list, what command should I use?

    Asked once · last asked May 7 · Concept · Junior

  53. What is a list, and what types of items can it contain?

    Asked once · last asked Jul 7 · Concept · Junior

  54. What does the loop in a function that checks whether parentheses are balanced do?

    Asked once · last asked Jul 17 · Concept · Junior

  55. Can you explain your approach to checking whether a string of parentheses is balanced and properly nested?

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

  56. What are the different types of linked lists?

    Asked once · last asked Aug 8 · Concept · Junior

  57. How would you implement a linked list in Python, and what operations should it support?

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

  58. How would you improve a bracket-matching algorithm?

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

    Other ways it was asked
    • “How could you improve the bracket-matching script?”
  59. How do you approach solving linked-list problems?

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

  60. Implement a linked list.

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

  61. How would you define redundant braces in your own words?

    Asked once · last asked Sep 10 · Concept · Junior

  62. How would you refine an approach to detecting redundant parentheses?

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

    Other ways it was asked
    • “What would you improve in your approach to detecting redundant parentheses?”
  63. What is a stack?

    Asked once · last asked Oct 1 · Concept · Junior

  64. Can you explain the difference between a Python list and a linked list?

    Asked once · last asked Oct 6 · Concept · Junior

  65. How are pointers related to linked lists?

    Asked once · last asked Oct 6 · Concept · Junior

  66. In Java, how does an ArrayDeque store elements internally, and what happens when it becomes full and needs to grow?

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

    Other ways it was asked
    • “In Java, how does a deque store elements internally, and what happens when it becomes full and needs to grow?”
  67. What data structure would you use to model passengers boarding a roller coaster at an amusement park?

    Asked once · last asked Oct 19 · Concept · Junior

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.