Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Noman's Birthday

By nurshuvo51 · Limits 1s, 512 MB

Today is our friend Noman's birthday. For celebration of his birthday, we have already used n baloons to decorate the walls of the party room. These baloons are of two colors- red and green. After sometime, we came to know that Noman liked baloons arranged in such a manner that no adjacent two baloons have the same color.

So, we decided that if our arrangement does not match with Noman's choice, we will change it. We want to make Noman happy tomorrow.

The arrangement of n baloons is represented as a sequence of '0' and '1', where '0' represents red color and '1' represents green color. For example, if n = 5 and the sequence is "01101" it implies that first and fourth baloons are colored with red and others are colored with green.

Your task is to say if the sequence of baloons matches with Noman's choice or not.


The first line consists of an integer n(1<=n<=100), the number of baloons. The next line represents the arrangement of n ballons as a sequence where a '0' means
red baloon and a '1' means green baloon.


If the sequence of baloons matches with Noman's choice then print the line "No change needed" else print "Change needed" (without quotation).



Change needed

No change needed



97% Solution Ratio

dip_BRUREarliest, Jan '20

dip_BRURFastest, 0.0s

SAIF_IITLightest, 0 B

AnotherTwinkleShortest, 84B


Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.