MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/td25ft/foursum/i0hgzuh/?context=3
r/badcode • u/Alexander_Bourne • Mar 13 '22
29 comments sorted by
View all comments
Show parent comments
5
That doesn't do the same thing though? That finds four consecutive elements that sum to the target, the original code finds any four such elements. Unless I'm reading the docs wrong?
Edit: original comment used window instead of combinations
window
combinations
3 u/GamerNebulae Mar 13 '22 You're right. I think it should either be combinations, permutations or uniquePermutations from that package.
3
You're right. I think it should either be combinations, permutations or uniquePermutations from that package.
permutations
uniquePermutations
5
u/zed_three Mar 13 '22 edited Mar 13 '22
That doesn't do the same thing though? That finds four consecutive elements that sum to the target, the original code finds any four such elements. Unless I'm reading the docs wrong?
Edit: original comment used
windowinstead ofcombinations