Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Language in Context?

Answered: 1 week ago