0
How could you get all the convolution instances k of n elements with just one for loop?
Ex. Input: [1,2,3,4,5] with n=5, k=3 Output: [1,2,3], [1,2,4], [1,2,5],[1,3,4], [1,3,5], [1,4,5], [2,3,4], [2,3,5], [2,4,5], [3,4,5].
1 Antwort
+ 5
Those are called combinations, not convolutions!
Use itertools: https://code.sololearn.com/c9Y9YbduxqwU/?ref=app