Get the positions of elements after a sliding window on a list of numbers

73 Views Asked by At

Let L be a list of numbers as [7,9,0,3,5,2] . When creating a sliding windows of stride 1 and size 3 I have the following windows :

(7,9,0) (9,0,3) (0,3,5) (3,5,2) . Then I applied function on every on window and I get a score of each value on the window.

and I store them in the new Liste : P = [f(1,7),f(1,9),f(1,0),f(2,9),f(2,0),f(2,3), f(3,0),f(3,3),f(3,5), f(4,3),f(4,5),f(4,2)] where f is a function that take 2 input (a window index and a value).

How can I get the scroes of each element on L ?

For example, the number 9 has two scores f(1,9) and f(2,9).

The number 0 has three scores : f(1,0),f(2,0) and f(3,0).

0

There are 0 best solutions below