Practice problems
Choose a topic, work through an example, and reveal a hint or worked answer when you’re ready.
Showing 101–120 of 145 problems
Fenwick trees and dynamic prefix sums
Which indexes are read using i -= i & -i?
Segment trees and range queries
What is the new sum at the root?
Monotonic stacks
What is the next greater value for 1?
What happens when code runs?
The program adds 3 to the input score before comparing it with 6. Predict the exact message.
Debug by tracing state
The sample should sum every number. What is the first incorrect state, and how would you fix it?
Test boundaries and edge cases
A locker room allows a group size from 1 through 8 inclusive. Decide which boundary values are accepted.
How an HTTP request works
Match each successful server response or failure to the interface message that fits.
Build an accessible HTML structure
Choose an element for each user operation.
Design a responsive layout
A card needs 280px of space. Can two cards and a 16px gutter fit a container that is 560px wide?
Tables, keys and constraints
An entry references an existing book and stores pages read. Identify the constraints needed to reject missing books and negative counts.
Files, folders, and the terminal
Where does the shell look for lessons?
Bits, bytes, and binary numbers
What decimal value does it represent?
Git commits and diffs
Does a commit automatically include the latest edit?
Scope and lifetime
Can the caller still use the list?
Evaluate a machine learning model
A model flags eight items. Six are relevant, and there are ten relevant items altogether. Calculate precision and recall.
Model Android UI state
Decide which user-visible state to show when the app receives a successful response with zero results.
Model SwiftUI screen state
A user changes a title and taps Cancel. Which title should the list show?
Unicode and UTF-8
How long is Aé in bytes?
Value copies and shared references
Which outer list shows the added value?
The call stack
Which function resumes immediately after B returns?