I came up with a similar solution but simplified a bit more:

class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode* slow = head;
ListNode* fast = head;
while(fast && fast->next) {
slow = slow->next;
fast = fast->next->next;
if(slow == fast) {
return true;
}
}
return false;
}
};

There's no need to check for

if(head == NULL || head -> next == NULL)
return false;

This information is contained in while(fast && fast->next)