Skip to content

Instantly share code, notes, and snippets.

@gudnm
Created September 5, 2016 22:19
Show Gist options
  • Save gudnm/5b4bf341a34671531d77d2f4d2599c50 to your computer and use it in GitHub Desktop.
Save gudnm/5b4bf341a34671531d77d2f4d2599c50 to your computer and use it in GitHub Desktop.
Sherlock and the Beast problem from Hackerrank, in LOLCODE
HAI 1.1
I HAS A t ITZ A YARN
GIMMEH t
MAEK t A NUMBR
VISIBLE t
BTW I HAS A count ITZ 0
IM IN YR mainloop UPPIN YR count TIL BOTH SAEM count AN t
I HAS A n ITZ A NUMBR
GIMMEH n
VISIBLE n
I HAS A c ITZ 0
IM IN YR loop NERFIN YR n WILE BIGGR OF n AN 0
VISIBLE n!
n R DIFF OF n AN 4
c R SUM OF c AN 1
BOTH SAEM MOD OF n AN 3 AN 0, O RLY?
YA RLY
GTFO
OIC
IM OUTTA YR loop
SMALLR OF n AN 0, O RLY?
YA RLY
VISIBLE "-1"
NO WAI
IM IN YR printloop NERFIN YR n TIL BOTH SAEM n AN 0
VISIBLE "5"!
IM OUTTA YR printloop
IM IN YR printloop NERFIN YR c TIL BOTH SAEM c AN 0
VISIBLE "3"!
IM OUTTA YR printloop
OIC
IM OUTTA YR mainloop
KTHXBYE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment