Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,329 views
in Online Assessments by Expert (34,270 points) | 1,329 views

1 Answer

0 like 0 dislike

QUESTION -
Given a string S of length N, Return the count of all the possible Unique Sub-Sequences of Length N-2, which can be derive from given string (each Sub-Sequences should have length = N-2).
String contains only number from 0 to 9.
As the result can be large return ans module (10^9) + 7.

 

sample test 1 -
input string : "15025"
output : 10
Explaination : All Unique Sub-Sequencesof length (5-2) 3 are - "025","525","505","502","125","105","155","125","150","102"

 

sample test case 2 :
input string : "781484"
output : 14

 

Constrains -
0 <= s[i] <= 9
2 <= N <= 100000

by Expert (34,270 points)