Introduction
It is an easy level math problem. I did submit 6 times until I fixed all the issues. Such a great workout. I need this kind of training.
My practice
I came out two ideas and decide to go for one of ideas. Here are my highlights of my mistakes.
1. Non-negative numbers -> should include zero;
2. 0 + 4 = 4, so given number 4, return true;
3. a * a + b * b = c, a and b can be same number;
4. given value 0, 0 + 0 = 0.
5. Last executed input: 2147483646, I put the numbers into the list and then convert it to the array.
Memory limit executed. No need to use extra space.
I like to share my practice on leetcode.com, here is the link.
No comments:
Post a Comment