Episode 7 — DSA with JavaScript / 7.12 — Linked List
7.12 — Interview Questions: Linked List
Beginner
Q1. Reverse list?
Answer: Iterate with prev/curr/next pointers
Beginner
Q2. Detect cycle?
Answer: Floyd's slow/fast pointers
Beginner
Q3. Find middle?
Answer: Slow (1 step) and fast (2 steps)
Beginner
Q4. Merge two sorted?
Answer: Dummy head, compare and link
Beginner
Q5. Remove nth from end?
Answer: Two pointers, n apart
Intermediate
Q6. Linked list vs array?
Answer: LL: O(1) insert/delete, O(n) access
Intermediate
Q7. Doubly vs singly?
Answer: Doubly: O(1) delete at tail, more memory
Intermediate
Q8. Palindrome check?
Answer: Find middle, reverse second half, compare
Intermediate
Q9. Sort linked list?
Answer: Merge sort — O(n log n), O(1) space
Intermediate
Q10. LRU Cache?
Answer: Doubly LL + HashMap
Quick-fire table
| # | Question | Answer |
|---|---|---|
| 1 | Reverse list? | Iterate with prev/curr/next pointers |
| 2 | Detect cycle? | Floyd's slow/fast pointers |
| 3 | Find middle? | Slow (1 step) and fast (2 steps) |
| 4 | Merge two sorted? | Dummy head, compare and link |
| 5 | Remove nth from end? | Two pointers, n apart |
| 6 | Linked list vs array? | LL: O(1) insert/delete, O(n) access |
| 7 | Doubly vs singly? | Doubly: O(1) delete at tail, more memory |
| 8 | Palindrome check? | Find middle, reverse second half, compare |
| 9 | Sort linked list? | Merge sort — O(n log n), O(1) space |
| 10 | LRU Cache? | Doubly LL + HashMap |
Rapid self-check cards
SC-001
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-002
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-003
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-004
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-005
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-006
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-007
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-008
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-009
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-010
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-011
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-012
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-013
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-014
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-015
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-016
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-017
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-018
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-019
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-020
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-021
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-022
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-023
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-024
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-025
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-026
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-027
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-028
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-029
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-030
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-031
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-032
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-033
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-034
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-035
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-036
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-037
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-038
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-039
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-040
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-041
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-042
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-043
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-044
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-045
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-046
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-047
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-048
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-049
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-050
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-051
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-052
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-053
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-054
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-055
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-056
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-057
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-058
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-059
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-060
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-061
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-062
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-063
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-064
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-065
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-066
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-067
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-068
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-069
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-070
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-071
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-072
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-073
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-074
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-075
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-076
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-077
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-078
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-079
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-080
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-081
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-082
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-083
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-084
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-085
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-086
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-087
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-088
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-089
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-090
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-091
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-092
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-093
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-094
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-095
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-096
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-097
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-098
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-099
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-100
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-101
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-102
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-103
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-104
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-105
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-106
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-107
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-108
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-109
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-110
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-111
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-112
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-113
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-114
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-115
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-116
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-117
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-118
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-119
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-120
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-121
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-122
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-123
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-124
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-125
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-126
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-127
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-128
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-129
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-130
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-131
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-132
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-133
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-134
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-135
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-136
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-137
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-138
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-139
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-140
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-141
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-142
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-143
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-144
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-145
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-146
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-147
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-148
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-149
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-150
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-151
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-152
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-153
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-154
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-155
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-156
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-157
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-158
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-159
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-160
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-161
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-162
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-163
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-164
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-165
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-166
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-167
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-168
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-169
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-170
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-171
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-172
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-173
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-174
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-175
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-176
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-177
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-178
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-179
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-180
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-181
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-182
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-183
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-184
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-185
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-186
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-187
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-188
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-189
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-190
- Q: LRU Cache?
- A: Doubly LL + HashMap
SC-191
- Q: Reverse list?
- A: Iterate with prev/curr/next pointers
SC-192
- Q: Detect cycle?
- A: Floyd's slow/fast pointers
SC-193
- Q: Find middle?
- A: Slow (1 step) and fast (2 steps)
SC-194
- Q: Merge two sorted?
- A: Dummy head, compare and link
SC-195
- Q: Remove nth from end?
- A: Two pointers, n apart
SC-196
- Q: Linked list vs array?
- A: LL: O(1) insert/delete, O(n) access
SC-197
- Q: Doubly vs singly?
- A: Doubly: O(1) delete at tail, more memory
SC-198
- Q: Palindrome check?
- A: Find middle, reverse second half, compare
SC-199
- Q: Sort linked list?
- A: Merge sort — O(n log n), O(1) space
SC-200
- Q: LRU Cache?
- A: Doubly LL + HashMap