This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a hole to the top of the jellyfish to attach to a keychain. | |
keychain = true; | |
// The number of tentacles segments that drop down the jellyfish. Increasing its number will increase the jellyfish size. | |
tentacles = 3; // [3:5] | |
// Select the mouth style. | |
mouth = 1; // [0:no mouth, 1:happy mouth, 2:sad mouth, 3:cute mouth] | |
// Select right eye style. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def encodeBinaryString(s: String) = { | |
s.foldLeft(List.empty[List[Char]]) { | |
case (List(), cur) => List(List(cur)) | |
case ((head @ h :: _) :: tail, cur) if cur == h => (cur :: head) :: tail | |
case (acc, cur) => List(cur) :: acc | |
}.map { | |
case l @ '1' :: _ => "0 " + "0" * l.size | |
case l @ '0' :: _ => "00 " + "0" * l.size | |
}.mkString(" ") | |
} |