I’ve been absolutely frustrated while trying to find out where am I going wrong in the “Coder Life Matters” question. My outputs to the example inputs are correct, and I’ve tried my own inputs, which gave correct answers but the online codechef judge is giving me “Wrong Answer”. Please tell me where I’m going wrong. Thanks !
Question :- Contest Page | CodeChef
Answer :- Solution: 17885794 | CodeChef
Why are u increasing j by 5?
Increase it by 1 and everything will work fine(U never consider ranges like (2,6),…etc)
All you need to do here is traverse the entire array. Whenever you find a 1, you need to check how many consecutive 1s are there. If the count exceeds 5, you should break the loop and print #coderlifematters. What you are doing here is you are just checking the sequences whose index start with a multiple of 5. You are ignoring other sequences, so you’re getting WA. Hope that helps