A9 Interview Question for abcs
- 1of 1 vote
AnswersTesting Strings
- pooja.senger86 October 29, 2017 in United States
Mr X and Mr Y, his friend are programmers and testers respectively working in the same company. So, once they faced the following scenario :
Mr X wrote an application that took as input some user data. The data the application took as input was a string in some strange language. That language consisted of
K
K distinct letters. However, due to some issues, the application got corrupted and one particular String among many was lost.
However, Mr X had seen that String once before it got lost. He remembers some info about it. Particu-larly, he remembers the lost String had length equal to
M
M.
Mr Y, being the chief QA person in his company needs to try and figure out the number of possible different possible candidate Strings for the lost String.
Mr X remembers N pieces of info. For each one, he gives you 2 numbers
L
L and
R
R and a number
Z
Z. He remembers for sure that the
Z
t
h
Zth letter of the language of the string did not occur between positions
L
L and
R
R inclusive of the lost String.
Input Format :
The first line contains
3
3 space separated integers
N
N ,
M
M and
K
K.
Each of the next
N
N contains
3
3 space separated integers, denoting
L
L ,
R
R and
Z
Z respectively.
Output Format :
You need to find and print the number of different possible candidate Strings for the lost String based on the info Mr X remembers. As the number of such Strings can be large, print it Modulo
10
6
+
3
106+3
Constraints:
1
≤
N
,
M
,
K
≤
10
5
1≤N,M,K≤105
1
≤
L
≤
R
≤
M
1≤L≤R≤M
1
≤
Z
≤
K
1≤Z≤K
Sample Input
1 2 26
1 2 1
Sample Output
625| Report Duplicate | Flag | PURGE
A9 abc .Net/C Java
Interview Type: Written Test
Please format this question. I guess the format is messed up for some reason
- viswajith October 30, 2017