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

Is the following logic correct? Maximum number of snakes that can be eaten = number of occurrences of substring "sm" +number of occurrences of substring "ms"  the number of occurrences of substring "sms". Overlapping substrings are considered different and counted. For example "smsms" number of occurrences of substring "sm"=2 number of occurrences of substring "ms"=2 the number of occurrences of substring "sms"=2 answered 02 Jun '17, 04:43

Here is my solution in c++: https://www.codechef.com/viewsolution/13948382 It was giving me wrong answer. why it is wrong. answered 02 Jun '17, 12:20

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
