본문 바로가기

Java/Java 알고리즘 모음

[Java 알고리즘] 5. 정렬/탐색 모음

반응형

 

https://cote.inflearn.com/contest/10/problem/06-04

 

OnlineJudge

 

cote.inflearn.com

https://and-some.tistory.com/580

 

[Ch.06 - SortSearch] 04. LRU (Least Recently Used) 최근 최소 사용 알고리즘

4. Least Recently Used 설명 캐시메모리는 CPU와 주기억장치(DRAM) 사이의 고속의 임시 메모리로서 CPU가 처리할 작업을 저장해 놓았다가 필요할 바로 사용해서 처리속도를 높이는 장치이다. 워낙 비싸

and-some.tistory.com

 

list 메서드

더보기

set

list.set(위치, 숫자);

remove할 경우, 모든 '2' 삭제시

list.removeAll(Arrays.asList(2));

첫번째 2만 삭제시

list.remove(Integer.valueOf(2));

 

https://cote.inflearn.com/contest/10/problem/06-05

 

OnlineJudge

 

cote.inflearn.com

https://and-some.tistory.com/581

 

[Ch.06 - SortSearch] 05. 중복 확인

5. 중복 확인 설명 현수네 반에는 N명의 학생들이 있습니다. 선생님은 반 학생들에게 1부터 10,000,000까지의 자연수 중에서 각자가 좋아하는 숫자 하나 적어 내라고 했습니다. 만약 N명의 학생들이

and-some.tistory.com

 

 

https://cote.inflearn.com/contest/10/problem/06-06

 

OnlineJudge

 

cote.inflearn.com

https://and-some.tistory.com/582

 

[Ch.06 - SortSearch] 06. 장난 꾸러기

6. 장난꾸러기 설명 새 학기가 시작되었습니다. 철수는 새 짝꿍을 만나 너무 신이 났습니다. 철수네 반에는 N명의 학생들이 있습니다. 선생님은 반 학생들에게 반 번호를 정해 주기 위해 운동장

and-some.tistory.com

 

 

https://cote.inflearn.com/contest/10/problem/06-07

 

OnlineJudge

 

cote.inflearn.com

https://and-some.tistory.com/584

 

[Ch.06 - SortSearch] 07. 좌표 정렬

7. 좌표 정렬 설명 N개의 평면상의 좌표(x, y)가 주어지면 모든 좌표를 오름차순으로 정렬하는 프로그램을 작성하세요. 정렬기준은 먼저 x값의 의해서 정렬하고, x값이 같을 경우 y값에 의해 정렬

and-some.tistory.com

 

 

https://cote.inflearn.com/contest/10/problem/06-08

 

OnlineJudge

 

cote.inflearn.com

https://and-some.tistory.com/585

 

[Ch.06 - SortSearch] 08. 이분검색

8. 이분검색 설명 임의의 N개의 숫자가 입력으로 주어집니다. N개의 수를 오름차순으로 정렬한 다음 N개의 수 중 한 개의 수인 M이 주어지면 이분검색으로 M이 정렬된 상태에서 몇 번째에 있는지

and-some.tistory.com

 

 

https://cote.inflearn.com/contest/10/problem/06-09

 

OnlineJudge

 

cote.inflearn.com

https://and-some.tistory.com/587

 

[Ch.06 - SortSearch] 09. 뮤직비디오(결정알고리즘)

9. 뮤직비디오(결정알고리즘) 설명 지니레코드에서는 불세출의 가수 조영필의 라이브 동영상을 DVD로 만들어 판매하려 한다. DVD에는 총 N개의 곡이 들어가는데, DVD에 녹화할 때에는 라이브에서의

and-some.tistory.com

 

 

https://cote.inflearn.com/contest/10/problem/06-10

 

OnlineJudge

 

cote.inflearn.com

https://and-some.tistory.com/589

 

[Ch.06 - SortSearch] 10. 마구간 정하기(결정알고리즘)

10. 마구간 정하기(결정알고리즘) 설명 N개의 마구간이 수직선상에 있습니다. 각 마구간은 x1, x2, x3, ......, xN의 좌표를 가지며, 마구간간에 좌표가 중복되는 일은 없습니다. 현수는 C마리의 말을

and-some.tistory.com

 


문제 해결 순서

1. int형 -> 문자열 변경하는 2가지 방법

2. 문자열로 int 표현시 "0" 처리하는 2가지 방법

3. 직접 더해보지 않고, 정렬하는 방법

 

https://school.programmers.co.kr/learn/courses/30/lessons/42746

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

가장 큰 수

 

이분탐색 lt,rt -> 유효한 lt,rt 설정

https://www.acmicpc.net/problem/2512

 

2512번: 예산

첫째 줄에는 지방의 수를 의미하는 정수 N이 주어진다. N은 3 이상 10,000 이하이다. 다음 줄에는 각 지방의 예산요청을 표현하는 N개의 정수가 빈칸을 사이에 두고 주어진다. 이 값들은 모두 1 이상

www.acmicpc.net

 

 

https://and-some.tistory.com/823

 

[Java 알고리즘] (1) 그리디, 정렬, 이분탐색, 시뮬레이션

1. 기지국 설치 - 그리디 2. 가장 큰 수- 정렬 3. 예산 - 이분 탐색 4. 숫자 게임 - 시뮬레이션 1. 기지국 설치 - 그리디 https://school.programmers.co.kr/learn/courses/30/lessons/12979?language=java 프로그래머스 코드

and-some.tistory.com

https://and-some.tistory.com/639

 

[프로그래머스 - 이분탐색] 03. 예산

3. 예산 문제 설명 국가의 역할 중 하나는 여러 지방의 예산요청을 심사하여 국가의 예산을 분배하는 것입니다. 국가예산의 총액은 미리 정해져 있어서 모든 예산요청을 배정해 주기는 어려울

and-some.tistory.com

 

 


https://leetcode.com/problems/move-zeroes/submissions/

 

Move Zeroes - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

https://and-some.tistory.com/887

 

 

[LeetCode- Ch.2 정렬 & 검색] 1. 제로 이동

https://leetcode.com/problems/move-zeroes/submissions/ Move Zeroes - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import java.util.*; cla

and-some.tistory.com

 

 

https://leetcode.com/problems/kth-largest-element-in-an-array/submissions/

 

Kth Largest Element in an Array - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

https://and-some.tistory.com/888

 

[LeetCode- Ch.2 정렬 & 검색] 2. K번째 제일 큰 원소

https://leetcode.com/problems/kth-largest-element-in-an-array/submissions/ Kth Largest Element in an Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next intervi

and-some.tistory.com

 

 

https://leetcode.com/problems/k-closest-points-to-origin/submissions/

 

K Closest Points to Origin - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

https://and-some.tistory.com/889

 

[LeetCode- Ch.2 정렬 & 검색] 3. 원점에 가장 가까운 지점

https://leetcode.com/problems/k-closest-points-to-origin/submissions/ K Closest Points to Origin - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetco

and-some.tistory.com

 

https://www.lintcode.com/problem/920/

 

LintCode 炼码

 

www.lintcode.com

https://and-some.tistory.com/890

 

[LeetCode- Ch.2 정렬 & 검색] 4. 미팅룸

https://leetcode.com/problems/meeting-rooms/ Meeting Rooms - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com https://www.acmicpc.net/problem

and-some.tistory.com

 

 

https://www.lintcode.com/problem/920/

 

LintCode 炼码

 

www.lintcode.com

https://and-some.tistory.com/891

 

[LeetCode- Ch.2 정렬 & 검색] 5. 미팅룸2 - 최소 회의실 개수

https://leetcode.com/problems/meeting-rooms-ii/ Meeting Rooms II - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com https://www.acmicpc.net/p

and-some.tistory.com

 

 

https://leetcode.com/problems/merge-intervals/submissions/

 

Merge Intervals - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

https://and-some.tistory.com/892

 

[LeetCode- Ch.2 정렬 & 검색] 6. interval 병합

https://leetcode.com/problems/merge-intervals/submissions/ Merge Intervals - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 케이스 분

and-some.tistory.com

 

 

https://leetcode.com/problems/reorder-data-in-log-files/submissions/

 

Reorder Data in Log Files - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

https://and-some.tistory.com/893

 

[LeetCode- Ch.2 정렬 & 검색] 7. 로그 파일의 데이터 재정렬

https://leetcode.com/problems/reorder-data-in-log-files/submissions/ Reorder Data in Log Files - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode

and-some.tistory.com

 

반응형