Skip to content

Instantly share code, notes, and snippets.

@bky373
Created September 7, 2020 16:33
Show Gist options
  • Save bky373/0c79796c79778cefb9f503130ba85ee3 to your computer and use it in GitHub Desktop.
Save bky373/0c79796c79778cefb9f503130ba85ee3 to your computer and use it in GitHub Desktop.
class Solution {
fun solution(s: String): String {
return when(s.length % 2){
0 -> s.subSequence((s.length / 2) - 1, (s.length / 2) + 1).toString()
else -> s.subSequence((s.length-1) / 2, (s.length-1) / 2 + 1).toString()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment