Lately, Ive been trying many questions.For some fairly simple questions, I end up with the correct algorithm and code. It gives the correct answer for many test cases.(even the boundaries) but when i submit i get wrong answer. Ive seen many people (using same alto) get wrong answers and then finally correct it. What is that you people do. Is there anything special other than using % when dealing with modulus 10^9+7, and which data type do you use to handle very very large integers in c/ c++. Im using long long (%lld). Please give me suggestions as how you correct the wrong answer. Its been really frustrating?
There you can find a link to a tutorial where a good starting explanation about large integers representation is given… So, if you can read it and afterwards correctly solve that problem, it means you have understood the underlying idea behind large integers representation.
I also came across similar problems, some of which can be corrected by using these methods :
Check for corner cases, specially for bottom cases.
If you are incrementing a variable to count something, check that you have initialized it to 0.
If there are multiple test cases, and you are using a counter variable, check that you initialize the counter variable to 0 everytime you have a new test case.
Hope this would help to some extent. It may be frustrating in the beginning but do not give up.