본문 바로가기
반응형

코테5

코테대비 문법정리 HashMap생성// HashMap 만들기Map map = new HashMap();값 추가map.put("apple", 3); // apple → 3 저장map.put("banana", 5); // banana → 5 저장map.put("apple", 10); // apple → 10 (덮어쓰기)값 읽기int v = map.get("apple"); // 10Integer x = map.getOrDefault("orange", 0); // 없으면 기본값 0boolean hasKey = map.containsKey("apple"); // true/false값 삭제map.remove("apple");map.clear(); // 모든 키·값 삭제반복// 1) 키 기준for (String key :.. 2025. 9. 18.
Codility Lesson 참고 투포인터/슬라이딩 윈도우 레슨15: https://app.codility.com/programmers/lessons/15-caterpillar_method/해시맵/배열 카운팅 기본(FrogRiverOne, MissingInteger)레슨4: https://app.codility.com/programmers/lessons/4-counting_elements/누적합·슬라이딩윈도우 (PassingCars)레슨5: https://app.codility.com/programmers/lessons/5-prefix_sums/스택( Brackets )레슨7: https://app.codility.com/programmers/lessons/7-stacks_and_queues/DP (MaxSliceSum)레슨9: htt.. 2025. 9. 18.
Codility Test 너무 간만에 문제를 풀어봅니다ㅋㅋ온라인 직무테스트 링크를 보니 Codility가 있어서 찾아보니 아래처럼 프로그래머스처럼 기업이 사용하는 코테 사이트가 있었습니다.coding test site : https://app.codility.com/programmers/특징으로는 영어로 문제가 나옵니다!문제1) A binary gap - Find longest sequence of zeros in binary representation of an integer.// you can also use imports, for example:// import java.util.*;// you can write to stdout for debugging purposes, e.g.// System.out.println(".. 2025. 9. 11.
까먹을수 있는 문법 정리_1 1) Arrays.sort는 int[]는 정렬이 안된다. Integer여야만 한다. 체크~ Arrays.sort의 default 정렬은 오름차순이다.(1->2->3 등 점점 올라가는) 내림차순으로 해주려면 Comparator.reverseOrder()를 넣어줘야한다. 2) Arrays.asList로 만든 List는 remove가 동작하지 않는다. 동작하려면 아래와 같이 생성해야한다. List tempList = new ArrayList(Arrays.asList(tempArr)); 3) List를 String으로 표현하려면? String.join()을 사용하면 된다. import java.util.*; import java.util.Arrays; class Solution { public String so.. 2023. 8. 25.
코딩 테스트 - 프래그래머스 코딩 테스트를 풀어보자:) https://programmers.co.kr/ 문자열 출력하기 난이도 0레벨 ㅋㅋ 아래처럼 소스를 짜고! 코드를 실행! 와우! 점수를 준다 ㅋㅋㅋ 굿~최대 점수가 3점인가?? 14점도 있었다..ㅎㅎ 다른 사람의 풀이도 볼수 가 있다! ㅋㅋ 역시 코딩에 정답이 없어! 여러가지 답이 나올수 있다! 대학교때 생각이 물씬 난다 ㅎㅎ 다른소스를 보니 a.length()가 중복이라 변수로 처리했다. 굿! 앞으로 종종 풀어보자:) 2023. 7. 18.
반응형