sequense like these: 1 2 2 3 3 3 2
let's call them balloons :)
at the beginning of every day,all balloons with the same color(number) and with a count of bigger than 3 are blowed. for example in day 1, all balloons with name "3" is gonna blow and at the end of the day the remaining array is gonna shift like this: 1 2 2 2
and again in another morning all sub arrays with the common subarray bigger than 3 (compared by size) are blowed.
the output of the algorithm is an array with the same size of the input array that shows the day number of blowing of each ballon.
for example ==>
input: 1 2 2 3 3 3 2
output: -1 2 2 1 1 1 2
it shoes that ballon number 1 is never gonna blow because it's just 1 and never be bigger than 3. and it shoes that all balloons that their name was 3 are blowed at the first day. and then the 2 at the end of the array is shifted and all 2 2 2 are blowed at the second thay.
what do you do for implementing this algorithm?
please help it's important to me guys thank you all❤️
Обсуждают сегодня