Showing 12 questions
Implement a SQL class that supports basic database operations: creating tables, inserting rows, deleting rows based on a condition, and selecting specific columns from rows that match a condition.
#1. Design SQL
You're given a list that can contain integers or other nested lists. Implement an iterator to flatten this structure and yield only the integers one by one.
#2. Flatten Nested List Iterator
Simulate a simplified Excel sheet and implement the SUM formula. You'll need to parse cell ranges and calculate their sum.
#3. Design Excel Sum Formula
Design a key-value store that supports storing values associated with timestamps. You should be able to retrieve the value for a given key at the latest timestamp less than or equal to a given time.
#4. Time Based Key-Value Store
Implement a multithreaded web crawler to efficiently explore and retrieve pages from a website, respecting the website's rules.
#5. Web Crawler Multithreaded
Design an algorithm to encode a list of strings into a single string and then decode the single string back to the original list of strings.
#6. Encode and Decode Strings
Given an absolute file path (Unix style), simplify it by resolving redundant separators, directory names, and navigating back up the directory structure. Return the simplified canonical path.
#7. Simplify Path
Simulate a basic memory allocator. You'll need to allocate blocks of memory, track their IDs, and free them based on their ID.
#8. Design Memory Allocator
You're given a list of asteroids, each with a size and direction (positive is right, negative is left). Figure out which asteroids will survive after all collisions happen.
#9. Asteroid Collision
Find the largest value within each sliding 3x3 submatrix of a given matrix. Return a matrix containing these largest local values.
#10. Largest Local Values in a Matrix
Imagine a paint bucket tool. Given a starting pixel and a color, change all connected pixels of the same original color to the new color.
#11. Flood Fill
Convert an IP address and a number of addresses to a CIDR block representation. Find the smallest list of CIDR blocks that covers the specified range of IP addresses.
#12. IP to CIDR