Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • \$\begingroup\$ Would replacing ~s.search(d) with s.match(d) work? \$\endgroup\$ Commented Nov 8, 2017 at 16:19
  • \$\begingroup\$ I think you can save another byte by changing 0 to j++, removing the ++ from the j it was on before and then starting j from 0 instead of -1. \$\endgroup\$ Commented Nov 8, 2017 at 16:28
  • \$\begingroup\$ I think I was able to switch to a single loop: n=>eval("for(r=[j=i='0'];i<=n;)r[j]|[...''+j].some(d=>i.match(d))?j++:(i=++i+'',r[k=j]=1,j=0);k") \$\endgroup\$ Commented Nov 8, 2017 at 16:35
  • \$\begingroup\$ @Neil a single loop would be wonderful \$\endgroup\$ Commented Nov 8, 2017 at 20:06
  • \$\begingroup\$ @Neil the single loop is great, thanks \$\endgroup\$ Commented Nov 8, 2017 at 20:49