UVA 10035 - Primary Arithmetic accepted :) sweet :) but, it was on the 7th attempt.
Tip: if you are printing the output, add the '\n' after every output.
I tried solving it in two ways:
1. Taking the numbers into char arrays:
The char array solution was difficult to code because I reversed each array, started to iterate until the array with min length, then traverse until the end of the longer array to get to the final answer. I made a number of mistakes here:
* Instead of iterating over revNum1, I iterated of num1
* The minLen was using the length of the larger array (mainly due to copy paste)
* I had to construct quite a few testcases to assure myself of the correctness
2. Taking the numbers as numbers:
This was simpler to code and I knew that I had the correct answer without crossing my fingers unlike the previous option. Keeping the implementation simpler assures you of the 'Accepted' state and you know that a 'WA' in this case means that something is wrong in the output format and not your code :-)
Also I could reuse the logic from my earlier solution to 10018 - Reverse and Add.