Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize the left pointer at the start of the string.
DSA Go
left := [1]Attempts:
3 left
💡 Hint
Common Mistakes
Starting left pointer at the end of the string.
Using negative index which is invalid.
✗ Incorrect
The left pointer should start at index 0 to begin checking from the start of the string.
2fill in blank
mediumComplete the code to initialize the right pointer at the end of the string.
DSA Go
right := [1]Attempts:
3 left
💡 Hint
Common Mistakes
Using len(s) as index which is out of range.
Starting right pointer at 0 which is the start.
✗ Incorrect
The right pointer should start at the last index, which is length of string minus one.
3fill in blank
hardFix the error in the condition to skip non-alphanumeric characters on the left pointer.
DSA Go
for left < right && !isAlphanumeric(s[[1]]) { left++ }
Attempts:
3 left
💡 Hint
Common Mistakes
Using right pointer index inside left pointer loop.
Using fixed index like 0 or len(s) which causes errors.
✗ Incorrect
We check the character at the left pointer index to skip non-alphanumeric characters.
4fill in blank
hardFill both blanks to skip non-alphanumeric characters on both pointers.
DSA Go
for left < right && !isAlphanumeric(s[[1]]) { left++ } for left < right && !isAlphanumeric(s[[2]]) { right-- }
Attempts:
3 left
💡 Hint
Common Mistakes
Using same pointer for both loops.
Using fixed indices instead of pointers.
✗ Incorrect
Use left pointer index for the first loop and right pointer index for the second loop to skip invalid characters.
5fill in blank
hardFill all three blanks to compare characters ignoring case and move pointers accordingly.
DSA Go
if strings.ToLower(string(s[[1]])) != strings.ToLower(string(s[[2]])) { return false } [3]++ right--
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing wrong indices.
Not moving pointers after comparison.
✗ Incorrect
Compare characters at left and right pointers ignoring case, then move left pointer forward and right pointer backward.
