Back to Python Data Structures, Algorithms & Interview Prep
Final Assessment

Python Data Structures, Algorithms & Interview Prep Final Assessment

Test your algorithmic problem-solving mastery across Big-O & Python internals, hash maps & prefix sums, two pointers & sliding windows, monotonic stacks, backtracking, binary search & sorting, linked lists, trees, heapq, graphs & topological sort, dynamic programming, LRU Cache, and Dijkstra. Score 70% or higher to earn your certificate.

Answered 0 of 15 questionsPass mark: 70%
Question 1

Question 1 of 15

What is the time complexity of items.pop(0) on a Python list of n elements?

Question 2

Question 2 of 15

Why does the hash-map two_sum solution run in O(n) time instead of O(n²)?

Question 3

Question 3 of 15

Why must group_anagrams convert sorted(word) into tuple(sorted(word)) before using it as a dictionary key?

Question 4

Question 4 of 15

Why is a variable-size Sliding Window algorithm with an inner while loop still O(n) overall?

Question 5

Question 5 of 15

In daily_temperatures, what ensures the monotonic stack solution runs in O(n) time?

Question 6

Question 6 of 15

In a recursive backtracking function, why must you append path.copy() rather than path to result?

Question 7

Question 7 of 15

What condition allows solving an optimization problem via Binary Search on Answer?

Question 8

Question 8 of 15

What makes Python's built-in Timsort and Merge Sort 'stable'?

Question 9

Question 9 of 15

In Floyd's Cycle Detection (slow = slow.next, fast = fast.next.next), what is the space complexity?

Question 10

Question 10 of 15

Why does level_order BFS snapshot for _ in range(len(q)): before popping nodes?

Question 11

Question 11 of 15

Why is checking only node.left.val < node.val < node.right.val wrong for validating a Binary Search Tree?

Question 12

Question 12 of 15

How do you simulate a max-heap using Python's heapq (which is a min-heap)?

Question 13

Question 13 of 15

In Kahn's Topological Sort algorithm, what indicates that a directed prerequisite graph contains a cycle?

Question 14

Question 14 of 15

Why does @functools.lru_cache speed up recursive Dynamic Programming problems like Coin Change or House Robber?

Question 15

Question 15 of 15

In Dijkstra's weighted shortest-path algorithm with heapq, why do we skip if cost > dist.get(node, inf): continue?

Answer 15 more questions to submit.