Panda Guru LogoPanda
Guru

Amazon Online Assessment - 2025

Round 1

Questions: A secured variation of the passwords is defined as a subsequence of customers password which is lexicographically greater than system generated password.

Formally:

The task is to count how many subsequences of password s are lexicographically greater than password t. Since the answer can be large, return the result modulo 10^9 + 7.

Note:

Example 1:

s = "aba" t = "ab"

All possible subsequences of s = aba:

Of all possible subsequences of s: 3 are smaller, 1 equal and 3 are greater than t so the answer is 3.

Example 2:

s = "bab" t = "ab"

All possible subsequences of s = bab:

Of all possible subsequences of s: 1 is smaller, 1 is equal and 5 are greater than t, so the answer is 5.

Constraints:

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.