Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
[creative] Scientific imports + 1-liner: Markov chain solution in 3rd party category for Pearls in the Box by Phil15
import numpy as np
from scipy.sparse import spdiags
checkio=lambda s,n:np.linalg.matrix_power(spdiags((np.roll(t:=np.linspace(0,1,d:=len(s)+1),-1),np.roll(1-t,1)),(-1,1),d,d).toarray(),n-1)[s.count('w')]@t
Feb. 7, 2021
Comments: