Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- mybatis
- Java
- Security
- IntelliJ
- 자바
- GitHub
- db
- 알고리즘
- Git
- 함수
- 에러
- Eclipse
- oracle
- error
- aws
- 생성
- JavaScript
- 스프링
- JPA
- Spring
- 쿼리
- 시큐리티
- jquery
- 넥사크로
- Vue
- 프로그래머스
- 방법
- 코틀린
- kotlin
- 오라클
Archives
- Today
- Total
송민준의 개발노트
[프로그래머스] 음양 더하기 본문
https://programmers.co.kr/learn/courses/30/lessons/76501?language=java
코딩테스트 연습 - 음양 더하기
어떤 정수들이 있습니다. 이 정수들의 절댓값을 차례대로 담은 정수 배열 absolutes와 이 정수들의 부호를 차례대로 담은 불리언 배열 signs가 매개변수로 주어집니다. 실제 정수들의 합을 구하여 re
programmers.co.kr
class Solution {
public int solution(int[] absolutes, boolean[] signs) {
int result = 0;
for(int i = 0; i < absolutes.length; i++) {
result += absolutes[i] * (signs[i] ? 1 : -1);
}
return result;
}
}
'알고리즘 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 오픈채팅방 (0) | 2022.04.28 |
---|---|
[프로그래머스] 더 맵게 (0) | 2022.04.25 |
[프로그래머스] 없는 숫자 더하기 (0) | 2022.04.18 |
[프로그래머스] 키패드 누르기 (0) | 2022.04.18 |
[프로그래머스] 숫자 문자열과 영단어 (0) | 2022.04.10 |