Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

KING - DREAMS - I Once upon a time, a King saw a dream, where if his kingdom has food line of tanks. meaning tanks

KING-DREAMS-I Once upon a time, a King saw a dream, where if his kingdom has food line of tanks. meaning tanks lined up side by side in a certain way, they will become invincible. Now, since you are the advior of the king, he has asked you to create a good line of tanks. There are " types of tanks, numbered i through m , and we have infinite amount of tanks for each type. Come up with a good line of size n tanks. If there are multiple good line return one which is lexographically smallest. good tine is a configuration where tanks lined up in an array and the count of subarrays with only distinct tank types is maximum. e.g 3,4,4,5 contains 6 subarrays with distinct tanks: (3),4,4,(5,3,4,4,5) An array x is lexicographically smaller than an array y if there exists an index i such that xe^(2)y , and (x)/()=y for all t1<=n<=1000001<=m<-10000000nmnmn\xi i Constraints 1<=n<=1000001<=m<-10000000 Input Format The only line contain space seperated integer values n and m, where n is the size of good line m is the number of tank types Output Format Return a list of size n. Sample Input Example 1 Input: 12 Output: 11<=j. Less formally, at the first index t in which they differ, \xi i Constraints 1<=n<=1000001<=m<-10000000 Input Format The only line contain space seperated integer values n and m, where n is the size of good line m is the number of tank types Output Format Return a list of size n. Sample Input Example 1 Input: 12 Output: 1

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

Step: 3

blur-text-image

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

Public Finance

Authors: Harvey S. Rosen

3rd Edition

0256083762, 978-0256083767

Students also viewed these Databases questions