[
linked list
]
BinarySearch 0093 A Strictly Increasing Linked List
Problem statement
https://binarysearch.com/problems/A-Strictly-Increasing-Linked-List/
Solution
Just traverse our linked list and if we have next element less or equal than current, return False. Return True in the end if we reached it.
Complexity
It is O(n)
for time and O(1)
for space.
Code
class Solution:
def solve(self, head):
while head.next:
if head.next.val <= head.val:
return False
head = head.next
return True