Clear
This commit is contained in:
@@ -4,16 +4,16 @@ public class Solution
|
||||
{
|
||||
public ListNode? DetectCycle(ListNode head)
|
||||
{
|
||||
if(head == null)
|
||||
if (head == null)
|
||||
return null;
|
||||
ListNode? cur = head;
|
||||
int bit = 1 << 28;
|
||||
int curAbs = 0;
|
||||
while (cur!=null && (curAbs & bit) == 0)
|
||||
while (cur != null && (curAbs & bit) == 0)
|
||||
{
|
||||
cur.val ^= bit;
|
||||
cur = cur.next;
|
||||
if(cur != null)
|
||||
if (cur != null)
|
||||
curAbs = cur.val < 0 ? (cur.val * -1) : cur.val;
|
||||
}
|
||||
cur = head;
|
||||
|
||||
Reference in New Issue
Block a user