New answers tagged

3 votes

Delannoy numbers

K (ngn/k), 18 bytes {0/x(+':+\)/1,y#1} Try it online! Port of my APL answer that does not use the binomial coefficient built-in. See the linked answer for the ...
user avatar
  • 64.8k
2 votes

Train Route Planning

05AB1E, 44 bytes æʒø2£ø˜Á2ôćRJs€ËP*}ε0svy¦¦`U©%∞<®*+Dr@ÏнX+]ß Outputs an empty string if no valid route can be found. What a mess.. Those arbitrary ...
user avatar
2 votes

Train Route Planning

Python 3, 119 bytes f=lambda a,n=0,t=0:t*(n==1)or min([f(a-{(x,y,s,i,d)},y,s-(s-t)//i*i+d)for x,y,s,i,d in a if x==n]or[max(sum(a,()))**2]) Try it online!
user avatar
  • 6,528
3 votes

Train Route Planning

Python3, 111 bytes: f=lambda t,s=0,D=0:min(m)if(m:=[D]*(s==1)+[K for a,b,c,d,e in t if a==s and(K:=f(t,b,max(c%d-D,0)+D+e))])else[] Try it online!
user avatar
  • 3,296
3 votes

Train Route Planning

JavaScript (ES6), 102 bytes Expects an array of tuples [ from, to, base, interval, duration ]. Returns \$+\infty\$ if there's no solution. ...
user avatar
  • 169k

Top 50 recent answers are included