반응형

알고리즘/해커랭크 3

[해커랭크003] Diagonal Difference

Practice>Algorithms>Warmup>Diagonal Difference 포인트 1. 2중 List (기존 List와 유사하게 사용) - 삽입 .add(값) - 사용 .get(INDEX_NUM) - 수정 .set(INDEX_NUM, 수정값) 2. 절대값 함수 - Math.abs(적용값) 정답. import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; class Result { /* * Complete the 'diagonalDifference' function below..

[해커랭크002] A Very Big Sum

Practice>Algorithms>Warmup>A Very Big Sum 포인트 1. Long Type 길이 - 2,147,483,648 ~ 2,147,483,647(-2의31제곱~2의31제곱-1) - 초기화할때 뒤에 L(대소문자구분x) 정답 import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the aVeryBigSum function below. static long aVeryBigSum(long[] ar)..

[해커랭크001] Compare the Triplets

Practice>Algorithms>Warmup>Compare the Triplets 포인트 1. ArrayList - 삽입 .add(값) - 사용 .get(INDEX_NUM) - 수정 .set(INDEX_NUM, 수정값) 2. 반복문 3. 조건문 정답. import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the compareTriplets function below. static List compareTripl..

반응형