← ALL NOTES
Linked List

2058. Find the Minimum and Maximum Number of Nodes Between Critical Points

The minimum distance between two critical points is always between an adjacent pair, and the maximum is always between the very first and the very last one. Once I believed that, the whole problem collapses into a single walk that carries three integers.

Loading…