Skip to content

C++ practice problems

Problem of the day: Write the guard yourself
Difficulty:
Category & tags
Category:
Tag:

Showing 32 of 32

Title Difficulty
A raw pointer owns nothing Medium
Break an ownership cycle with weak_ptr Hard
Catch exceptions without slicing their type Medium
Choose integer width and overflow behavior Easy
Close a transaction when an operation throws Medium
Declare non-throwing Buffer moves Medium
Erasing while you walk Medium
Give an allocated object an owner Medium
Handle signed counts and unsigned sizes Medium
Implement copying and moving for an owned handle Hard
Keep ledger entries and their total consistent Medium
Let a vector own the histogram buckets Medium
Make temperature construction explicit Medium
Observe cleanup at the end of a scope Easy
Read a compiler diagnostic Easy
Reading text you do not own Medium
Read payloads without copying their contents Easy
Reserve space before filling a vector Easy
Restore memberwise moves with the Rule of Zero Medium
Say it in the signature Easy
Scale pixel channels safely Easy
Skip invalid fields without losing valid results Medium
Summarize a range with standard algorithms Medium
The accessor that will not let you look Easy
The lookup that writes Medium
Update elements through references Medium
What gets compiled with your code Easy
What is left after you move from it Medium
When std::move selects a copy Medium
Write the guard yourself Medium
Your first C++ lint check Easy
Zero is an answer Easy