Last active
August 3, 2020 11:57
-
-
Save UNISERVO1/652aa601928f6a1871e706a966e744af to your computer and use it in GitHub Desktop.
August LeetCoding Challenge Week 1: Day 1
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
class Solution { | |
fun detectCapitalUse(word: String): Boolean { | |
return word.all{ it.isLowerCase() } || | |
word.all{ it.isUpperCase() } || | |
(word.first().isUpperCase() && word.drop(1).all{ it.isLowerCase() }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment