Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6),  55 53  48 bytes

JavaScript (ES6),  55 53  48 bytes

Thanks to @KevinCruijssen for noticing that I was not fully assuming \$a\le b\$ (saving 5 bytes)

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&b-a>2?2:b>20&b-a>1|b>29

Try it online!

#JavaScript (ES6),  55 53  48 bytes

Thanks to @KevinCruijssen for noticing that I was not fully assuming \$a\le b\$ (saving 5 bytes)

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&b-a>2?2:b>20&b-a>1|b>29

Try it online!

JavaScript (ES6),  55 53  48 bytes

Thanks to @KevinCruijssen for noticing that I was not fully assuming \$a\le b\$ (saving 5 bytes)

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&b-a>2?2:b>20&b-a>1|b>29

Try it online!

saved 5 bytes
Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

#JavaScript (ES6),  55 53  5348 bytes

Thanks to @KevinCruijssen for noticing that I was not fully assuming \$a\le b\$ (saving 5 bytes)

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&(aa=>b=>a<0|a>29|b>30|b>21&b-=b)*a>4a>2?2:b>20&a*a>1|b>29b>20&b-a>1|b>29

Try it online!Try it online!

#JavaScript (ES6),  55  53 bytes

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&(a-=b)*a>4?2:b>20&a*a>1|b>29

Try it online!

#JavaScript (ES6),  55 53  48 bytes

Thanks to @KevinCruijssen for noticing that I was not fully assuming \$a\le b\$ (saving 5 bytes)

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&b-a>2?2:b>20&b-a>1|b>29

Try it online!

saved 2 bytes
Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

#JavaScript (ES6), 55 55  53 bytes

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$3\$\$2\$ (invalid).

a=>b=>3*(a<0|a>29|b>30|b>21&a=>b=>a<0|a>29|b>30|b>21&(a-=b)*a>4)|b>20&a*a>1|b>29?2:b>20&a*a>1|b>29

Try it online!Try it online!

#JavaScript (ES6), 55 bytes

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$3\$ (invalid).

a=>b=>3*(a<0|a>29|b>30|b>21&(a-=b)*a>4)|b>20&a*a>1|b>29

Try it online!

#JavaScript (ES6),  55  53 bytes

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&(a-=b)*a>4?2:b>20&a*a>1|b>29

Try it online!

Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650
Loading