1class Solution:
2 def hasCycle(self, head: Optional[ListNode]) -> bool:
3 if head is None:
4 return False
5
6 while head.next:
7 if head.val is None:
8 return True
9
10 head.val = None
11 head = head.next
12
13 return False
Solution to "Count Number of Texts" question on Leetcode.
Solution to "Second Minimum Node In a Binary Tree" on Leetcode.