Created
July 7, 2019 14:25
-
-
Save cg4jins/13d9e2f1f60a74f09d06f9118d08823d to your computer and use it in GitHub Desktop.
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 solution(s: String): String { | |
val length = s.length | |
return if (length % 2 == 0){ | |
s.substring(length/2-1, length/2+1) | |
}else{ | |
s.substring(length/2, length/2+1) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment