Infytq 2020 - solved problems
Updated on - 1.04.2020 Wednesday
​
Finding Interesting Numbers - Problem
​
The digits from 0 to 9 are grouped into two following categories:
​
-
Even Category: it consists of fo all even digits - 0,2,4,6 and 8
-
Odd Category: it consists of all odd digits - 1,3,5,7 and 9
An integer is said to be interesting if the count of its odd digits is even and the count of its even digits is odd.
​
The examples of interesting integers are as follows:
-
If the provided number is 2, then the count of odd digits is equal to 0, that is even and the count of even digits is equal to 1, this is odd.
-
You are given two integers L and R. Your task is to find the number of interesting numbers in the range(L,R] (L exclusive, R inclusive) modulo 10^9 + 7
​
​
Constraints
1<len(L)<=10^4
1<len(R)<=10^4
​
Input format from custom testing
​
-
The first line contains a string L denoting L
-
The next line contains a string R denoting R
​
Sample Input: Sample output
1 4
9
​
Explanation
​
The interesting integer between 1 and 9 is 2,4,6 and 8
​
​
​
New Company name - Problem
​
A new company needs to be named. You are given a list of names of all the exiting companies. Now, your task is to print the lexicographically smallest name for the company.
​
There is a restriction that there should not be any substring that is common among all the existing companies' names and the new company's name.
​
Input format
​
-
The first line contains t denoting the number of test cases.
-
the first line of each test case contains N denoting total existing companies
-
The next line contains a string of length at most 20 denoting the names of those N comopanies.
​
Output format
For each test case you are required to print the name of a new company, If it is impossible to name it, then print -1.
​
Constraints
1<=t<=100
1<=N<=10^4
​
All existing companies have names in lowercase English letters.
the name of the new company should be in lowercase English letters only
​
Sample Input Sample output
​
1 b
2
hackerearth
​
Explanation
​
In the sample test case if you name the new company as "b" then you see that it does not have any substring that matches and also it is the lexicographical smallest name.
​
