Skip to main content
added 2 characters in body
Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Pari/GP, 51 bytes

f(a,b)=[l[1]-i|i<-[1..#a],l=[j|j<-[i..#a],a[j]==b]]

Try it online!


Pari/GP, 5453 bytes

f(a,b)=s=t=0;Vecrev=s=t=0;r=Vecrev;r([s=!d*s++|c<-Vecrevr(a),t+=d=c==b])

Try it online!Try it online!

Pari/GP, 51 bytes

f(a,b)=[l[1]-i|i<-[1..#a],l=[j|j<-[i..#a],a[j]==b]]

Try it online!


Pari/GP, 54 bytes

f(a,b)=s=t=0;Vecrev([s=!d*s++|c<-Vecrev(a),t+=d=c==b])

Try it online!

Pari/GP, 51 bytes

f(a,b)=[l[1]-i|i<-[1..#a],l=[j|j<-[i..#a],a[j]==b]]

Try it online!


Pari/GP, 53 bytes

f(a,b)=s=t=0;r=Vecrev;r([s=!d*s++|c<-r(a),t+=d=c==b])

Try it online!

added 396 characters in body
Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Pari/GP, 51 bytes

f(a,b)=[l[1]-i|i<-[1..#a],l=[j|j<-[i..#a],a[j]==b]]

Try it online!


Pari/GP, 54 bytes

f(a,b)=s=t=0;Vecrev([s=!d*s++|c<-Vecrev(a),t+=d=c==b])

Try it online!

Pari/GP, 54 bytes

f(a,b)=s=t=0;Vecrev([s=!d*s++|c<-Vecrev(a),t+=d=c==b])

Try it online!

Pari/GP, 51 bytes

f(a,b)=[l[1]-i|i<-[1..#a],l=[j|j<-[i..#a],a[j]==b]]

Try it online!


Pari/GP, 54 bytes

f(a,b)=s=t=0;Vecrev([s=!d*s++|c<-Vecrev(a),t+=d=c==b])

Try it online!

Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Pari/GP, 54 bytes

f(a,b)=s=t=0;Vecrev([s=!d*s++|c<-Vecrev(a),t+=d=c==b])

Try it online!