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*

6
  • 2
    \$\begingroup\$ +1 to compensate the unexplained downvote ... As far as I can tell, this is a perfectly functional solution. \$\endgroup\$ Commented Oct 17, 2016 at 15:32
  • 1
    \$\begingroup\$ I got it down to 215 converting s to a char[] char[]c=s.toCharArray();int z=c[1]-c[0],y=c[2]-c[1],... \$\endgroup\$ Commented Oct 17, 2016 at 16:08
  • \$\begingroup\$ @dpa97 Thanks for the reminder to use char[] as input instead of String. -38 bytes thanks to you. \$\endgroup\$ Commented Oct 17, 2016 at 17:18
  • 1
    \$\begingroup\$ Your booleans can be optimized: z,x and w,y must have an alternating sign, so it suffices to check z*x<0 and w*y<0 \$\endgroup\$ Commented Oct 17, 2016 at 21:27
  • \$\begingroup\$ @KarlNapf Ah, I misinterpreted your comment a few hours ago. I've implemented your derived formula for a whopping -63 bytes. :) Thanks. \$\endgroup\$ Commented Oct 18, 2016 at 12:24