PROBLEM LINK:Author: Praveen Dhinwa DIFFICULTY  PREREQUISITES  PROBLEM  QUICK EXPLANATION  The question is of ad  hoc and greedy type. The question states It can be easily solved if each mongoose uses the greedy strategy of first checking if its immediate left neighbour and if not possible to eat it then check its right neighbour. EXPLANATION  Iterate over all the mongoose from left to right and for each mongoose check if its immediate left neighbour can be eaten, if yes, then increment the answer and move to the next mongoose. Otherwise, check if its immediate right neighbour can be eaten, if yes, then increment the answer and move on. By checking a neighbour we mean, we need to check that the particular position is occupied by a snake which is NOT eaten already. The pseudocode will be 
Time Complexity  AUTHOR'S AND TESTER'S SOLUTIONS:
This question is marked "community wiki".
asked 31 May '17, 22:41

Here is my solution in java: answered 01 Jun '17, 21:48

Here is my solution in c++: https://www.codechef.com/viewsolution/13948382 It was giving me wrong answer. answered 02 Jun '17, 12:22
For the below Input:
(02 Jun '17, 13:23)
Hey refer my solution below, did using boolean array to keep track of eaten and noneaten snakes. :)
(02 Jun '17, 13:30)

Here's my simple cpp solution: https://www.codechef.com/viewsolution/13909341 answered 02 Jun '17, 13:29

This is my solution https://www.codechef.com/viewsolution/13924801 it says wrong answer can anyone tell me where did I do wrong because the provided test case have been verified. answered 02 Jun '17, 14:36

Here's a solution without maintaining any record array's. https://www.codechef.com/viewsolution/13915068 answered 02 Jun '17, 17:26

Here is my solution, it is giving correct output to me but giving wrong answer on codechef.com Please have a look of my code. https://www.codechef.com/viewsolution/13955047 and https://www.codechef.com/viewsolution/13954434 both are two different solution and giving wrong answer on codechef.com answered 02 Jun '17, 17:50

here's my solution in c. Can anybody tell me why it is giving me wrong answer.plzzzzz https://www.codechef.com/viewsolution/13990446 answered 02 Jun '17, 20:00

https://www.codechef.com/viewsolution/13999283 hey what's wrong with this code. its giving me wrong answer. Plz help answered 03 Jun '17, 00:54

Could someone help me figure out what is wrong with this solution: https://www.codechef.com/viewsolution/13973763 Thanks in advance. answered 04 Jun '17, 01:21

Here's my code in Java : https://www.codechef.com/viewsolution/14120288 . Apparently, it is the wrong answer. I can't seem to find any mistake in it. Can anyone help me in finding my errors. answered 07 Jun '17, 01:20

hey what's wrong with this code. its giving me wrong answer. https://www.codechef.com/viewsolution/14135108 answered 07 Jun '17, 18:21
@suddu, In the first loop you may look for snakes outside the string.
(07 Jun '17, 19:36)

What I did was I moved from left to right until n1 and check if i th and i+1 th characters are different. If they are different I skip this check for i+1 th index and increase a counter by 1. In the end I count 's' and 'm' and subtract counter value from 's' and check what is greater and write the answer. But this approach gave me a wrong answer can someone tell me why? answered 07 Jun '17, 20:26

i have written code in c.what is wrong with these code? https://www.codechef.com/viewsolution/14162288 answered 08 Jun '17, 22:02

My code in java : https://www.codechef.com/viewsolution/14163077. It is giving wrong answer. I am not able to find out the reason. Sir, can you please help me out to find the error. Thank You. answered 08 Jun '17, 22:53

Here is my C# answer : https://www.codechef.com/viewsolution/14176253 Unfortunately I am receiving runtime error here. Can anyone please help me out? answered 09 Jun '17, 15:18

why i am getting run time error, my code is: https://www.codechef.com/viewsolution/14254014 since this code executed successfully in visual studio with proper output. answered 14 Jun '17, 20:55

Hey what's wrong with this code. Its giving me wrong answer.. https://www.codechef.com/viewsolution/14270370 answered 17 Jun '17, 18:23

Here is my solution in C++, getting output correctly but in codechef it is showing wrong answer. Please have a look. https://www.codechef.com/viewsolution/14271038 answered 17 Jun '17, 20:27

hi have a small problem here my solution is present in the link https://www.codechef.com/viewsolution/14382866 i am getting wrong answer as the result but my c compiler is not giving any wrong output i am scratching my head at this please tell me for which case my answer is wrong appreciate any help thanks answered 01 Jul '17, 14:28

@deeptamandas There are cases where you are subtracting the same snake twice from your total snake count. For Example consider the testcase: 1 msmmssss Expected Output : "tie". Your Output : "mongooses" (because you subtracted the count for the first snake twice) . answered 01 Jul '17, 18:01

MY code is working fine in blueJ for all possible outputs but it is still giving runtime error NZEC https://www.codechef.com/viewsolution/14688892 answered 27 Jul '17, 22:44

Can someone please have a look at my solution and tell why it is wrong? It seems to pass all test cases. answered 03 Oct '17, 19:43

https://www.codechef.com/viewsolution/15954256 can anybody help me out ...why i m getting wrong ans answered 25 Oct '17, 14:35

try 1 msssssmsm tie this test case will solve your doubt answered 28 Mar, 01:12

Someone help me!!!!!!! https://www.codechef.com/viewsolution/18228793 answered 13 Apr, 12:26
