Two sum: Difference between revisions
Content added Content deleted
m (→{{header|Quackery}}: spelling) |
|||
Line 2,119: | Line 2,119: | ||
So… I initially misread the task as "return the two integers" and then realised it was "…the indices of…", but that's OK — it just meant writing an extra word to find the indices, given the numbers. |
So… I initially misread the task as "return the two integers" and then realised it was "…the indices of…", but that's OK — it just meant writing an extra word to find the indices, given the numbers. |
||
The last three lines of <code>task</code> are in case the two integers found by <code> |
The last three lines of <code>task</code> are in case the two integers found by <code>twosum</code> are equal - in which case, as <code>find</code> finds the first instance in the array and the array is sorted, we can safely take the index plus one as the second index. |
||
<lang Quackery> [ 0 peek ] is first ( [ --> n ) |
<lang Quackery> [ 0 peek ] is first ( [ --> n ) |