- The number is said to be beautiful if it contains exactly one 1s ,two 2s , three 3s and so on .A number is given as input and we need to output the smallest beautiful number greater than the given number.
Examples of beautiful numbers :
sample test cases:
2.We are given an array and a number k .Here we need to split the given array in to k sub arrays such that each subarray consists of at least one element in it. We can split an array in many ways but we need to split the given array in two ways so that we get minimum and maximum possible cost .we need to output the difference of this max and min values.(cost of a subarray= first element + last element)
we have to split the given array in to two subarrays
[1,3] [5,1] this combination gives maximum cost i.e (1+3)+(5+1)=10
 [3,5,1] this combination gives minimum cost i.e (1+1)+(3+1)=6
If there are any similar questions of this type please share them with me