Question: Please ans ASAP ..in Java Coffee Break puzzle; string Generation Watson has mapped each small alphabet of english language with numbers in this way, a

 Please ans ASAP ..in Java Coffee Break puzzle; string Generation Watson

Please ans ASAP ..in Java

Coffee Break puzzle; string Generation Watson has mapped each small alphabet of english language with numbers in this way, a is mapped to 1 , b is mapped to 2, c is mapped to 3 . 90 on 411z is mapped to 26. He detines a function M(x) as the mapping of character x.M(a)=1,M(z)=26 efo. Now watson gives two numbers N and k. and asks - sherlocks to generate tor him a string of NCharacters, where each character nust belong to the sef p of charaders. The set p is defined as p={x:x is a small alphubet ; and 1M(x)k} Two conditims: 1) Each character of set p must occuris at leait once in the generated string. 2) Let Fi is the prequeney of cheracter i in the qenerated sting. This frequerey must be even if M(i) is even and similanly it should be odd if M(i) is odd. Input format First line contains T, th no. p. test cases. Fach test case comsists N and k in me live SampleIaput:23221 Sample outfut: abb No such string Output format : For eack test care, output in meline a sting Do of hergth N which follows all the bostraints mentioned. If there are mulipple such stringe, output the hexicogoaphically smoallest such string. era no such string Exists, output "No such string

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!