Vyxal g, 1511 bytes
ẏ:Ẋsλƒṡ1İ∑0=;csẊ'ƒṡ1İ∑0=
A simple little approach.
Explained
ẏ:Ẋsλƒṡ1İ∑0=;csẊ'ƒṡ1İ∑0=
ẏ: # The range [0, len(input)), twice.
ẊsẊ # cartesian product of the two lists and sort to get the first
' λ ;c # get the firstall itemitems of that where
ƒṡ # the list turned into an inclusive range between the two numbers
1İ # indexed into the sequence of numbers
∑0= # summed equals n
s # sort the list sog it'sflag ingets the rightsmallest order.pair
Vyxal, 15 bytes
ẏ:Ẋsλƒṡ1İ∑0=;cs
A simple little approach.
Explained
ẏ:Ẋsλƒṡ1İ∑0=;cs
ẏ: # The range [0, len(input)), twice.
Ẋs # cartesian product of the two lists and sort to get the first
λ ;c # get the first item of that where
ƒṡ # the list turned into an inclusive range between the two numbers
1İ # indexed into the sequence of numbers
∑0= # summed equals n
s # sort the list so it's in the right order.
Vyxal g, 11 bytes
ẏ:Ẋ'ƒṡ1İ∑0=
A simple little approach.
Explained
ẏ:Ẋ'ƒṡ1İ∑0=
ẏ: # The range [0, len(input)), twice.
Ẋ # cartesian product of the two lists and sort to get the first
' # get all items of that where
ƒṡ # the list turned into an inclusive range between the two numbers
1İ # indexed into the sequence of numbers
∑0= # summed equals n
# g flag gets the smallest pair
Vyxal, 15 bytes
ẏ:Ẋsλƒṡ1İ∑0=;cs
A simple little approach.
Explained
ẏ:Ẋsλƒṡ1İ∑0=;cs
ẏ: # The range [0, len(input)), twice.
Ẋs # cartesian product of the two lists and sort to get the first
λ ;c # get the first item of that where
ƒṡ # the list turned into an inclusive range between the two numbers
1İ # indexed into the sequence of numbers
∑0= # summed equals n
s # sort the list so it's in the right order.