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*

4
  • \$\begingroup\$ I think you need a function that only takes n as input. \$\endgroup\$ Commented Apr 20, 2017 at 0:52
  • \$\begingroup\$ @ChristianSievers fixed \$\endgroup\$ Commented Apr 20, 2017 at 9:13
  • 1
    \$\begingroup\$ Some things to golf for your current code: int h(String s){int m=0;for(int c:s.toCharArray())m+=c-48;return m;}int g(String t){int d=1,c=0;for(String s:t.split("[^0-9]"))d*=h(s);for(String s:t.split("[^A-Z]"))c+=s.charAt(0)-65;return d==c?1:0;}int f(String t,int n){int m=0;if(t.length()==n)return g(t);for(int d=48;d<58;)m+=f(t+d++,n);for(int c=65;c<91;)m+=f(t+c++,n);return m;}int s(int n){return f("",n);} (365 bytes) You can compare your current version with this one to see the changes I did (too much to fit in the remainder of this comment). :) \$\endgroup\$ Commented Apr 20, 2017 at 9:35
  • \$\begingroup\$ @KevinCruijssen thx, 17 bytes off now \$\endgroup\$ Commented Apr 20, 2017 at 9:42