networking · intermediate · ~15 min

Peak connections

Track a high-water mark.

Challenge

With the same ops, implement int peak_connections(const char *ops) returning the maximum number of simultaneous connections reached.

Starter code

int peak_connections(const char *ops) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.