Skip to main content
added 525 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 9 bytes

PÐƤ⁹L¤ƤḋM

A dyadic link which yields a list of all the maximal starting 1-based indices.

Try it online!

(or ṡL}PÐƤ€ḋM)

How?

PÐƤ⁹L¤ƤḋM - Link: list of returns, list of nominal investments
      Ƥ   - for infixes of (the returns)...
          - ...of length:
     ¤    -               nilad followed by links as a nilad:
   ⁹      -                 chain's right argument (nominals)
    L     -                 length
          - ...do:
 ÐƤ       -        for post-fixes:
P         -          product
       ḋ  - dot-product (each) with (the nominals)
        M - maximal indices

Jelly, 9 bytes

PÐƤ⁹L¤ƤḋM

A dyadic link which yields a list of all the maximal starting 1-based indices.

Try it online!

(or ṡL}PÐƤ€ḋM)

Jelly, 9 bytes

PÐƤ⁹L¤ƤḋM

A dyadic link which yields a list of all the maximal starting 1-based indices.

Try it online!

(or ṡL}PÐƤ€ḋM)

How?

PÐƤ⁹L¤ƤḋM - Link: list of returns, list of nominal investments
      Ƥ   - for infixes of (the returns)...
          - ...of length:
     ¤    -               nilad followed by links as a nilad:
   ⁹      -                 chain's right argument (nominals)
    L     -                 length
          - ...do:
 ÐƤ       -        for post-fixes:
P         -          product
       ḋ  - dot-product (each) with (the nominals)
        M - maximal indices
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 9 bytes

PÐƤ⁹L¤ƤḋM

A dyadic link which yields a list of all the maximal starting 1-based indices.

Try it online!

(or ṡL}PÐƤ€ḋM)