feat(content): more test cases
This commit is contained in:
@@ -10,6 +10,24 @@ categories:
|
||||
patterns:
|
||||
- fast-slow-pointers
|
||||
|
||||
function_signature: "def has_cycle(head: ListNode | None) -> bool:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { head: [3, 2, 0, -4], pos: 1 }
|
||||
expected: true
|
||||
- input: { head: [1, 2], pos: 0 }
|
||||
expected: true
|
||||
- input: { head: [1], pos: -1 }
|
||||
expected: false
|
||||
hidden:
|
||||
- input: { head: [], pos: -1 }
|
||||
expected: false
|
||||
- input: { head: [1, 2, 3, 4, 5], pos: -1 }
|
||||
expected: false
|
||||
- input: { head: [1, 2, 3, 4, 5], pos: 4 }
|
||||
expected: true
|
||||
|
||||
description: |
|
||||
Given `head`, the head of a linked list, determine if the linked list has a cycle in it.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user