Created
May 30, 2018 08:46
-
-
Save bijancn/a397f5d2ab7399c9a7f8c10cecb63ae8 to your computer and use it in GitHub Desktop.
Don't do this at home
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 countSpaces(word: List[Char]): Int = { | |
var i = 0 | |
var count = 0 | |
while (i <= word.length) { | |
if (word(i) == ' ') { | |
count += 1 | |
} | |
i += 1 | |
} | |
count | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment