Skip to main content
5 of 8
added 34 characters in body
betseg
  • 8.7k
  • 3
  • 28
  • 60

##C, 112 101 96 98 bytes

Thanks to @MartinEnder for saving 5 3 bytes while fixing my code!

j,i,k,l;f(char*s){l=strlen(s);for(i=l;j<l;)k+=(s[j++]-48)*(i>1?i--:-1);return!(k%11)&&k&&(l^8)<2;}

Returns 0 if invalid, 1 if valid. Try it online!

betseg
  • 8.7k
  • 3
  • 28
  • 60