less than 1 minute read

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 where n is the number of nodes in head

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.

Solution

Leave a comment