Cisco Hackathon Question for internship

Правка en1, от janardan_sharma, 2022-03-09 14:10:58

could anyone please help me out with an approach for this question which came in an hackathon by cisco for SWE interns.

String Wars

In this question you are given an integer n and you have to construct a string of length n using only two uppercase letters A and B and there is a condition that you cannot use two B's adjacent to each other in the constructed string and the string should be mth lexicographically smallest string. if the mth string is not possible then print -1.

Given : 1 <= n <= 90 1 <= m <= 10^19

Testcase 1: n = 2 m = 3 answer : "BA"

Testcase 2: n = 2 m = 4 answer : "-1" , as only 3 distinct strings can be constructed --> "AA", "AB", "BA".

Теги strings, constructive algorithms

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский janardan_sharma 2022-03-09 14:10:58 773 Initial revision (published)