Tuesday C++ interview question: The smallest missing positive integer.
Given a list of integers, determine the smallest missing positive integer. Importantly your solution must run in O(n) time, and while you are permitted to modify the input, you can only use constant additional memory.
Examples:
{3, -1, 0, 4, 1} -> 2
{1, 2, 3} -> 4
Solve it yourself: https://compiler-explorer.com/z/G7r4rebhd
Solution: https://compiler-explorer.com/z/G9h3EPaG8