Panda Guru LogoPanda
Guru

Amazon OA Question Based on Two Pointers

Round 1

Questions: image

Problem Statement: Given two strings, searchWord and resultWord:

Determine the minimum number of characters you need to append to resultWord so that it becomes a subsequence of searchWord.

Example: Input: searchWord = "abcz", resultWord = "azdb"
Output: 2
Explanation: By appending 'd' and 'b' to "azdb", we can transform it into a subsequence of "abcz".

Understanding the Problem:

A subsequence of a string is derived by deleting some or no characters from it without changing the order of the remaining characters. For example:

In this problem:

Input: Two strings, searchWord and resultWord.
Output: The number of characters to append to resultWord so that all characters in resultWord appear in order as a subsequence in searchWord.

First try yourself then see the actual approach it will help you to strong DSA problem solving skills

Explanation and Approach: Link to explanation

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.