본문 바로가기
알고리즘 & 자료구조/프로그래머스

내적

by 신재권 2022. 4. 16.
package programmers;

public class DotProduct {
   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;
   }
}

'알고리즘 & 자료구조 > 프로그래머스' 카테고리의 다른 글

124 나라의 숫자  (0) 2022.06.24
멀쩡한 사각형  (0) 2022.06.23
음양 더하기  (0) 2022.04.15
없는 숫자 더하기  (0) 2022.04.14
단체 사진 찍기  (0) 2022.04.13