Skip to content

Instantly share code, notes, and snippets.

@cg4jins
Created July 7, 2019 14:25
Show Gist options
  • Save cg4jins/13d9e2f1f60a74f09d06f9118d08823d to your computer and use it in GitHub Desktop.
Save cg4jins/13d9e2f1f60a74f09d06f9118d08823d to your computer and use it in GitHub Desktop.
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