Skip to content

Instantly share code, notes, and snippets.

@dalcon10028
Created July 7, 2020 10:50
Show Gist options
  • Save dalcon10028/453338bcf8d6e9ae38019500dd4a7633 to your computer and use it in GitHub Desktop.
Save dalcon10028/453338bcf8d6e9ae38019500dd4a7633 to your computer and use it in GitHub Desktop.
프로그래머스 코딩테스트 연습 Level1 - 가운데 글자 가져오기 [ Java ]
class Solution {
public String solution(String s) {
int half = s.length()/2;
return s.length()%2==0 ? s.substring(half-1, half+1) : s.substring(half,half+1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment