We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
What I am trying to check here is that if its the first ladybug of the array then it is possible to have only one neighbour. So it can be happy in only 1 condition and that is when the ladybug next to it is of same color. If its of different color or there is a space after it, then it won't be happy.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Happy Ladybugs
You are viewing a single comment's thread. Return to all comments →
What I am trying to check here is that if its the first ladybug of the array then it is possible to have only one neighbour. So it can be happy in only 1 condition and that is when the ladybug next to it is of same color. If its of different color or there is a space after it, then it won't be happy.