DEV Community 👩‍💻👨‍💻

Discussion on: Daily Coding Problem #1

caseywebb profile image
Casey Webb • Edited on

I just realized both of these solutions fail in the case of twoNumbersEqual([5], 10). This can be fixed by passing the index to includes, as such...

(a, k) => !!a.find((x, i) => a.includes(k-x, i+1))

This should also theoretically be more performant.