Challenge 1: Sorting Descending With a Lambda Comparator — Possible Solution ==================================================================== #include #include #include int main() { std::vector nums = {3, 7, 1, 9, 4}; std::sort(nums.begin(), nums.end(), [](int a, int b) { return a > b; }); for (int n : nums) { std::cout << n << std::endl; } return 0; } Output: 9 7 4 3 1 WHY THIS WORKS AS AN ANSWER ------------------------------ The lambda [](int a, int b) { return a > b; } is passed directly as std::sort's third argument, exactly the chapter's own pattern -- since it returns true when a should come BEFORE b in "greater than" order, std::sort produces a descending result instead of its default ascending one, with no separate named comparator function needed.