prev), current (curr), and next (next) nodes, starting with head, head.next, and head.next.next respectively.critical_points to store the indices of critical points.index to 1, min_distance to infinity, and max_distance to -1.next is not None.curr is a critical point by comparing its value with prev and next.index to critical_points.prev, curr, and next to move to the next set of nodes.index.[-1, -1].critical_points.critical_points.[min_distance, max_distance].