Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize the slow pointer at the head of the linked list.
DSA Python
slow = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Initializing slow to None or tail instead of head.
✗ Incorrect
The slow pointer starts at the head of the linked list to begin traversal.
2fill in blank
mediumComplete the code to move the fast pointer two steps ahead in the linked list.
DSA Python
fast = fast[1]next[2]next
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect operators like '->' or commas.
✗ Incorrect
In Python, to access the next node twice, use dot notation twice: fast.next.next.
3fill in blank
hardFix the error in the while loop condition to check if fast and fast.next exist.
DSA Python
while fast is not None and fast[1]next is not None:
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '->' which is not valid in Python.
✗ Incorrect
Use dot notation to access the 'next' attribute in Python: fast.next.
4fill in blank
hardFill both blanks to correctly move slow and fast pointers inside the loop.
DSA Python
slow = slow[1]next fast = fast[2]next.next
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '->' or commas instead of dot notation.
✗ Incorrect
Use dot notation to move slow one step and fast two steps ahead.
5fill in blank
hardFill both blanks to complete the cycle detection check inside the loop.
DSA Python
if slow == fast: return [1] return [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Returning None or 0 instead of True/False.
✗ Incorrect
If slow meets fast, a cycle exists, so return True. If loop ends, return False.