Похожие чаты

Hello guys i need a solution about an algorithm we have a

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?

1 ответов

8 просмотров
Peyman-EhsanDoost Автор вопроса

please help it's important to me guys thank you all❤️

Похожие вопросы

Обсуждают сегодня

А чем вам питонисты не угодили?😂
.
79
всем доброго времени суток! имею вопрос: как понять ТОЧНО, что на нексус производится атака или он перегружен? исходные данные: - Nexus OSS 3.67.1-01 на OrientDB - Total co...
Michael Kostelcev
11
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
or any website to buy prepaid card with xmr that's not trocador that's down?
Umbrella Party Partner
18
Hi, I can't understand promises in JavaScript and what we should use them for (maybe the teacher didn't teach well XD). Do you have a solution for this? And are promises used...
A
29
Ещё такой вопрос. Мне необходимо хранить пароль пользователя локально. Для этого планирую использовать ini файл. Это для автозаполнения полей логин и пароль при авторизации. Е...
Евгений
19
Добрый день, LO Writer, проблема с нумерацией таблиц (вставка названия). У меня два стиля нумерованных списка, один для основного текста (вида 1.1.1) другой доя приложений (ви...
Виктор
6
My assets the Oceans at Binance, its displaying passive and no automatically convert, this situation will change?
Nationalizze
8
Xem delist ho rha hai agr naa bhechu toh kya hoga after 1 july?
ABHI
27
Ты просто гитлеровскую эстетику плохо понимаешь. Он же всё под Цезаря делал. А это как бы запрещённый приём в политике. Пиджаки они зачем все носят? Чтобы показать что они тип...
Ivan Kropotkin
4
Карта сайта