input [0,0,4] and 4
I believe the answer should be [1,3], but in fact the giving answer is [2,3].
I think before we put the value into the hash table, we should check whether it has been exist.
I think it depends on the sequence you put the objects pair to hashtable and the loop sequene of searching.
Quote from the problem page:
"You may assume that each input would have exactly one solution."
So your input is invalid.
I have completed my code and it's working for valid inputs. But, I am facing a hard time submitting it. On submitting the code, it says that my code gives out a wrong answer for the input.
[0, 4, 3, 0]
I fail to understand why such input is being used here when the question mentions "You may assume that each input would have exactly one solution."
Any ideas on where should I report this ?
Thanks in advance.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.