← Discussions on Is Subsequence
K kavyanaidu
28 Sep 2026, 15:14

Finally got AC after 3 WAs. Sharing what I missed.

Work with character counts or indices rather than building new strings in the loop; string concatenation inside loops is what usually causes TLE here.

3 replies

vreddy 2 weeks, 5 days ago

Same idea, but I used a deque. Works fine.

akash_70 2 weeks, 1 day ago

This should be marked as the editorial approach honestly.

poojamenon 1 week, 5 days ago

You can avoid the extra array and do it in O(1) space.

Sign in to reply.