Загрузка...

Repititions CSES Problemset | Introductory Problems

Anyways, Let's just do the editorial in here.

Here is my logic about the problem. I can just check the previous index of s[i] with a restriction that the for loop of i have to start from 1 so that it could check the 0 index otherwise it is out of range error. Now, I just made two variables ANS and C. ANS is the answer which is always set to 1 and C is count which will update after the for loop has ended. Now after leaving the if statement, I would check the max between ans(which is just 1) and c(which will get updated after the loop) and outside the loop, I would print it. Any questions in the comments section would be answered ASAP.

Видео Repititions CSES Problemset | Introductory Problems канала The Math Maestro
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять