MY INTERVIEW SOLUTIONS INTER

MY INTERVIEW SOLUTION

Dhruvil has consistently been a contemplative individual and will be finishing his Engineering soon. He is consistently kneen about tackling issues and is getting ready hard for his next meeting at Hackerrank. He has polished loads of issues and now he went over this issue. 

Given a message containing English letters(A-Z), it is being encoded to numbers utilizing the accompanying planning: ‘A’ – > 1,’B’ – > 2 … ‘Z’ – > 26. 

Presently, given a non-void string containing just digits, help Dhruvil decide the all out number of approaches to translate it. 

While interpreting you have to pick a substring of charachters and not an aftereffect. Likewise a picked substring ought not contain any driving “0”s, yet can contain following “0”s. Since the yield can be extremely huge print the appropriate response as modulo 10^9 + 7 i.e 1000000007. 

 

Information: 

The main line of the information comprises of single whole number T, the quantity of experiments. Each experiment comprises of a string. 

 

Yield: 

For each experiment print a solitary number – the absolute number of approaches to translate the digit string. 

 

Imperatives 

1≤T≤1000 

2≤S≤109 

 

Test Input: 

12 

226 

 

Test Output: 

 

Clarification: 

There are 2 potential ways. It could be decoded as “Abdominal muscle” {1,2} or “L” {12}. 

There are 3 potential ways. It could be decoded as “BZ” {2,26}, “VF” {22,6}, or “BBF” {2,2,6}.

DOWNLOAD THE SOLUTION

Leave a Comment