Skip to content

Posts

C++ Basics: Subtract Sorted Inventories with Duplicate Counts

Use std::set_difference to remove requested occurrences from a sorted inventory.

Read more →

November 4, 2026

C++ Basics: Select a Median Without Sorting Every Element

Use std::nth_element to select the middle value of an odd-sized sample.

Read more →

November 4, 2026

C++ Basics: Rotate a Task List Without Losing Its Order

Move the first two tasks to the end with std::rotate and inspect its return iterator.

Read more →

November 4, 2026

C++ Basics: Remove the Largest Heap Value in Two Steps

Pair std::pop_heap with pop_back to remove the maximum element from a vector heap.

Read more →

November 4, 2026

C++ Basics: Order Sequences by Their First Difference

Compare integer paths with std::lexicographical_compare, including prefix cases.

Read more →

November 4, 2026

C++ Basics: Merge Two Sorted Lists Without Dropping Duplicates

Use std::merge to combine sorted inputs while retaining every occurrence.

Read more →

November 4, 2026

C++ Basics: Locate the First Broken Sort Order

Use std::is_sorted_until to report where a nondecreasing sequence first stops being sorted.

Read more →

November 4, 2026

C++ Basics: Group Priority Tasks While Preserving Arrival Order

Use std::stable_partition to put urgent work first without reordering either group.

Read more →

November 4, 2026

C++ Basics: Find the Whole Run of a Repeated Sorted Key

Use std::equal_range to locate all occurrences of a key in a sorted vector.

Read more →

November 4, 2026

C++ Basics: Find the First Drop in a Sequence

Apply std::adjacent_find with a predicate to detect a decreasing neighboring pair.

Read more →

November 4, 2026