Timeline for answer to Find the Infinity Words! by Billywob
Current License: CC BY-SA 3.0
Post Revisions
2 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 16, 2016 at 16:32 | comment | added | rturnbull |
Since you already have a check that length(s)==5, you can replace s[1]==tail(s,1) with s[1]==s[5]. A one-byte shorter method to check the length is is.na(s[6]). Together these two changes return TRUE for s of length 5 exactly and FALSE otherwise, as TRUE&NA is NA but FALSE&NA is FALSE. You can also save a few bytes by replacing !sum(sign(d))&any(rle(sign(d))$l>1) with !sum(a<-sign(d))&any(rle(a)$l>1).
|
|
| Oct 18, 2016 at 11:26 | history | answered | Billywob | CC BY-SA 3.0 |