๋ฌธ์
https://programmers.co.kr/learn/courses/30/lessons/12949
๋ด ๋ฌธ์ ํ์ด
def solution(arr1, arr2):
answer = [[0]*len(arr2[0]) for _ in range(len(arr1))]
for i in range(len(arr1)):
for j in range(len(arr2[0])):
for k in range(len(arr1[0])):
answer[i][j] += arr1[i][k] * arr2[k][j]
return answer
๐ ๊ตฌํ ๋ฌธ์ ๋ก, 3์ค for๋ฌธ์ ์ฌ์ฉํ์ฌ answer 2์ฐจ์ ๋ฆฌ์คํธ๋ฅผ ๋ง๋ค์ด์ฃผ๋ฉด ๋๋ค.
๐ก ํผ๋๋ฐฑ
- ๋ ์ด ํ๋ ฌ๊ณฑ ๋ฌธ์ ๋ ํ ๋๋ง๋ค for๋ฌธ ๋ง๋๋๊ฒ ํท๊ฐ๋ฆฌ๋๋ฐ,,
์๊ทธ๋ด๊น
'4๏ธโฃ Python > Problem Solving' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Python Algorithm] N๊ฐ์ ์ต์๊ณต๋ฐฐ์ Programmers(Lv.2) (0) | 2022.02.04 |
---|---|
[Python Algorithm] JadenCase ๋ฌธ์์ด ๋ง๋ค๊ธฐ Programmers(Lv.2) (0) | 2022.02.04 |
[Python Algorithm] ์ต๋๊ฐ๊ณผ ์ต์๊ฐ Programmers(Lv.2) (0) | 2022.02.04 |
[Python Algorithm] ์ต์๊ฐ ๋ง๋ค๊ธฐ Programmers(Lv.2) (0) | 2022.02.04 |
[Python Algorithm] ์นดํซ Programmers(Lv.2) (0) | 2022.02.03 |
๋๊ธ