அல்கோரிதம்comparison
Pointer comparison — மதிப்புகளால் நகர்த்தல்
TT
Testlaa Team
May 14, 2026•1 min read
nums[left] vs right ஒப்பிட்டு எந்த pointer நகர்கிறோம் என்பதைத் தேர்ந்தெடு; விடை skip ஆகாது.
Try this in Python
def is_subsequence(s: str, t: str) -> bool:
i = 0
for ch in t:
if i < len(s) and s[i] == ch:
i += 1
return i == len(s)
print(is_subsequence("ace", "abcde"))
Key takeaways
- Subsequence — pattern pointer + scan.
- Comparison-ஆல் advance.
- State machine போல.
Tags:
Two pointersPythonமாணவர்கள்
