Removed unnecessary condition

This commit is contained in:
Breno Baptista
2021-07-17 00:32:50 -03:00
parent 578c85e416
commit f5716a22aa

View File

@ -19,7 +19,7 @@ type ListNode = structures.ListNode
func hasCycle(head *ListNode) bool { func hasCycle(head *ListNode) bool {
fast := head fast := head
slow := head slow := head
for slow != nil && fast != nil && fast.Next != nil { for fast != nil && fast.Next != nil {
fast = fast.Next.Next fast = fast.Next.Next
slow = slow.Next slow = slow.Next
if fast == slow { if fast == slow {