Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
22 lines (19 loc) · 648 Bytes

File metadata and controls

22 lines (19 loc) · 648 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
* 문제 설명
* 길이가 같은 두 1차원 정수 배열 a, b가 매개변수로 주어집니다. a와 b의 내적을 return 하도록 solution 함수를 완성해주세요.
*
* 이때, a와 b의 내적은 a[0]*b[0] + a[1]*b[1] + ... + a[n-1]*b[n-1] 입니다. (n은 a, b의 길이)
*
* 제한사항
* a, b의 길이는 1 이상 1,000 이하입니다.
* a, b의 모든 수는 -1,000 이상 1,000 이하입니다.
*/
class InnerProduct {
public int solution(int[] a, int[] b) {
int answer = 0;
for (int i = 0; i < a.length; i++) {
answer += a[i] * b[i];
}
return answer;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.