c#
public class Solution { public string solution(string s) { string answer = ""; if(s.Length%2==0) { answer=s.Substring((s.Length/2)-1,2); }else { answer=s.Substring(s.Length/2,1); } return answer; } }
'코딩연습 > 프로그래머스 코딩테스트' 카테고리의 다른 글
[프로그래머스]Level1 자릿수더하기 (0) | 2020.10.08 |
---|---|
[프로그래머스]leve1 서울에서 김서방 찾기 (0) | 2020.07.14 |
[프로그래머스(C#)]level1 약수의 합 (0) | 2020.07.13 |
[프로그래머스C#]leve1 문자열을 정수로 바꾸기 (0) | 2020.07.13 |
[프로그래머스 leve1] 수박수박수 c# (0) | 2020.07.03 |