Skip to content

Instantly share code, notes, and snippets.

@cg4jins
Created July 24, 2019 08:52
Show Gist options
  • Save cg4jins/c3fb6de17279726b9ceff08dfd4eedbb to your computer and use it in GitHub Desktop.
Save cg4jins/c3fb6de17279726b9ceff08dfd4eedbb to your computer and use it in GitHub Desktop.
class Solution {
fun solution(seoul: Array<String>): String {
for ((idx, word) in seoul.withIndex()){
if (word == "Kim"){
return "김서방은 ${idx}에 있다"
}
}
return ""
}
}
@kei9327
Copy link

kei9327 commented Jul 24, 2019

오! withIndex 이용하면 int i 방식 사용 안해도 되겠군요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment