Skip to main content
added 97 characters in body
Source Link
Jack
  • 131
  • 4

Ruby 2.7.4, 5656 54 bytes

f=->(a,l){a.filter_map.with_index{|_,i|a[i..].index(l)}}

Filter maps over the array and finds the index of the target offset from the current index.

Try it on Replit!

Excited to have gotten my first Golf!

Ruby 2.7.4, 56 bytes

f=->(a,l){a.filter_map.with_index{|_,i|a[i..].index(l)}}

Filter maps over the array and finds the index of the target offset from the current index.

Excited to have gotten my first Golf!

Ruby 2.7.4, 56 54 bytes

->(a,l){a.filter_map.with_index{|_,i|a[i..].index(l)}}

Filter maps over the array and finds the index of the target offset from the current index.

Try it on Replit!

Excited to have gotten my first Golf!

Source Link
Jack
  • 131
  • 4

Ruby 2.7.4, 56 bytes

f=->(a,l){a.filter_map.with_index{|_,i|a[i..].index(l)}}

Filter maps over the array and finds the index of the target offset from the current index.

Excited to have gotten my first Golf!