A Strictly Increasing Linked List
Given the head of a singly linked list head
, return whether the values of the nodes are sorted in a strictly increasing order.
Constraints
1 ≤ n ≤ 100,000
wheren
is the number of nodes inhead
https://binarysearch.com/problems/A-Strictly-Increasing-Linked-List
Examples
Example 1
Input
- head =
Output
- answer =
False
Explanation
Even though this list is sorted, it’s not strictly increasing since 9
is repeated.
Example 2
Input
- head =
Output
- answer =
True
Explanation
The values 1, 5, 8, 9 are strictly increasing.
Leave a comment