#70128
๐ Question ?
https://school.programmers.co.kr/learn/courses/30/lessons/70128
class Solution {
fun solution(a: IntArray, b: IntArray): Int {
var answer: Int = 1234567890
return answer
}
}
๐งฉ Thought Process
- ์ธ๋ฑ์ค๊ฐ ๊ฐ์ ๋ ๋ฐฐ์ด์ ๊ณฑํ ์๋ก์ด ๋ฐฐ์ด ๋ง๋ค๊ธฐ
- ์๋ก ๋ง๋ค ๋ฐฐ์ด์ sum() ๊ตฌํ๊ธฐ
๐ Answer
class Solution {
fun solution(a: IntArray, b: IntArray): Int {
var answer = 0
for (i in 0 until a.size) {
answer += a[i]*b[i]
}
return answer
}
}
๐ Result
๐ Comment
'Algorithm > Kotlin' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค โข ์ฝํ๋ฆฐ] ์ฝ๋ผ ๋ฌธ์ #132267 (0) | 2023.12.13 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค โข ์ฝํ๋ฆฐ] ํธ๋ ํ์ดํธ ๋ํ #134240 (0) | 2023.12.12 |
[ํ๋ก๊ทธ๋๋จธ์ค โข ์ฝํ๋ฆฐ] ๊ฐ์ฅ ๊ฐ๊น์ด ๊ฐ์ ๊ธ์ #142086 (1) | 2023.12.06 |
[ํ๋ก๊ทธ๋๋จธ์ค โข ์ฝํ๋ฆฐ] ๋ ๊ฐ ๋ฝ์์ ๋ํ๊ธฐ #68644 (2) | 2023.12.04 |
[ํ๋ก๊ทธ๋๋จธ์ค โข ์ฝํ๋ฆฐ] K๋ฒ์งธ์ #42748 (0) | 2023.12.01 |