Step: 0/4

Inward — palindrome check

Compare mirrored characters from the two ends. If every pair matches, the string is a palindrome.

Problem · Is “RACECAR” a palindrome?
L
R
L moves right
R moves left
Comparison Ready Start from both ends
CompareCheck whether the characters at L and R are equal.
Move inwardWhen they match, move both pointers toward the center.
ResultIf L reaches R without a mismatch, the string is a palindrome.

Unidirectional — push zeros to the end

Fast scans the array. Slow marks the next position where a non-zero value should be placed.

Problem · Move all 0s to the end, preserving non-zero order
slow
fast
slow = next non-zero slot
fast = scanner
Decision Ready Array: [0, 1, 0, 3, 12, 0, 5]
ZeroIf fast sees 0, only fast moves forward.
Non-zeroPlace the value at slow, then advance slow and fast.
ResultNon-zero values keep their relative order; zeros collect at the end.

Parallel — highest value across two arrays

Walk both arrays together, compare the current pair, and keep the highest value seen so far.

Problem · Find the highest value among both arrays
A
i
B
j
Comparison Ready Highest so far: —
Compare pairCompare A[i] with B[j].
Track maximumUpdate the highest value if the current pair contains something larger.
ResultAfter both pointers finish, the tracked value is the maximum across both arrays.
InwardPalindrome · compare mirrored characters
UnidirectionalMove zeros · scan + write boundary
ParallelTwo arrays · compare in parallel