Answered step by step
Verified Expert Solution
Question
1 Approved Answer
KING - DREAMS - I once upon a time, a king saw a drearm, where if his kingdom has gond 1 ine of tanks .
KINGDREAMSI
once upon a time, a king saw a drearm, where if his kingdom has gond ine of tanks meaning tant lined up side thy side in a certair waly, they will become invinciblel.
Now, since you are the advior of the king, he has asked you to create a good line of tanks.
There are in types of tanks, numbered through and we have infinite amount of tanks for each type.
Come up with a good line of size in tanks. If there are multiple good line return one which is lexographically smallest.
Come up with a good line of size tanks. If there are multiple good ine return one which is lexographically smallest.
good line is a configuration where tanks lined up in an array and the count of subarrays with only distinct tank types is maximum. eg contains subarrays with distinct tanks:
An array? is lexicographically smaller than an array? if there exists an index such that and for all nm
Input Format
The only line contain space seperated integer values and where is the size of good line is the number of tank types
Output Format
Return a list of size
Sample Input
Example
Input:
Output:
Explanation: Max subarrays count with distinct tanks for line size is Possible line We choose as it is lexographically smallest.
Example
Input:
Output:
Explanation: The only possible line
Example
Input:
Output:
Explanation: Possible lines: Lines and has max count of subarrays with distinct tanks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started