Created
May 1, 2020 07:10
-
-
Save DongguemYoo/44db21ff5ae796c28d0b6e187defdb6b 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
//단순하게 생각해서 풀어서 답이 나왔긴 함 | |
string answer = ""; | |
for (int i = 0; i < seoul.Length; i++) | |
{ | |
if (seoul[i] == "Kim") | |
return answer = "김서방은 " + i + "에 있다"; | |
} | |
return answer; | |
//다른사람이 푼 문제에서 참고할 것 | |
### answer = Array.FindIndex(seoul,i=>i == "Kim"); | |
해당하는 index가 answer에 들어간다!! 엄청 간단한게 있었군 | |
### string.Format("김서방은 {0}에 있다",answer); | |
### 그리고 출력 할때 string.Format도 좀 쓰자 Debug.Log만 쓰다 보니까 안쓰게 되는듯... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment