#include "ListNode.h"
#include <stdbool.h>

bool hasCycle(struct ListNode *head)
{
    if (!head || !head->next)
        return false;

    struct ListNode *slow = head;
    struct ListNode *fast = head->next;

    while (slow != fast)
    {
        if (!fast || !fast->next)
            return false;

        slow = slow->next;
        fast = fast->next->next;
    }
    return true;
}

int main()
{
    return 0;
}
