Skip to content

Instantly share code, notes, and snippets.

@UNISERVO1
Last active August 3, 2020 11:57
Show Gist options
  • Save UNISERVO1/652aa601928f6a1871e706a966e744af to your computer and use it in GitHub Desktop.
Save UNISERVO1/652aa601928f6a1871e706a966e744af to your computer and use it in GitHub Desktop.
August LeetCoding Challenge Week 1: Day 1
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