SLICE PAY Online Assessment Hiring Question | Off-Campus (2024))
Slice · Question · Posted Jun 2026
Problem: Find the Minimum and Maximum Number of Nodes Between Critical Points A critical point in a linked list is a node that is either: A local maximum (greater than both neighbors) A local minimum (smaller than both neighbors) Given the head of a linked list, return an array: minDistance = minimum distance between any two critical points maxDistance = maximum distance between any two critical points If there are fewer than 2 critical points, return [-1, -1]. Example Input ...
The full answer & interview discussion are available to premium members.
Log in Create a free account