← 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 months ago

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

akash_70 1 month, 4 weeks ago

This should be marked as the editorial approach honestly.

poojamenon 1 month, 3 weeks ago

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

Sign in to reply.