We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I have some confusion about the size of the dict you may have used, even though I am not much familiar with python (so I maybe mistaken) I observe nowhere in code have you specified the size of the array. From what I can think the size of the dict should be the largest integer in the input.
Following is my understanding:
For eg : If array has only 2 inputs say 1 and 6.
and difference to be searched for is 5.
You would be searching for numbers[1+5] ie numbers[6], so here numbers[6] needs to be 1, while according to what you said the size of dict would be same as size of array which would not be true in this case.
Please correct me if I am mistaken.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
I have some confusion about the size of the dict you may have used, even though I am not much familiar with python (so I maybe mistaken) I observe nowhere in code have you specified the size of the array. From what I can think the size of the dict should be the largest integer in the input.
Following is my understanding:
For eg : If array has only 2 inputs say 1 and 6. and difference to be searched for is 5. You would be searching for numbers[1+5] ie numbers[6], so here numbers[6] needs to be 1, while according to what you said the size of dict would be same as size of array which would not be true in this case.
Please correct me if I am mistaken.