전체 글
-
1210. [S/W 문제해결 기본] 2일차 - Ladder1 - 자바(JAVA)알고리즘/SW Expert Academy 2022. 3. 12. 00:01
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14ABYKADACFAYh& SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제 해석 0과 1로 이루어진 보드가 존재합니다. 0은 이동할 수 없으며 1은 이동할 수 있습니다. 실제 사다리 게임을 하는 것처럼 아래로 내려가다가 왼쪽 또는 오른쪽으로 이동할 수 있다면 이동합니다. 목적지에 도달하게 된다면 시작점을 출력하는 문제입니다. 평소에 사용하던 좌표계인 data[세로][가로] 와는 다르게 data [가로][세로]의 형식을 띄고 있습니다. 또한 왼쪽 또는 한쪽 방향으로만..
-
1861. 정사각형 방 - 자바(JAVA)알고리즘/SW Expert Academy 2022. 3. 11. 00:01
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5LtJYKDzsDFAXc SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제 해석 N^2의 방이 NxN형태로 존재합니다. 위에서 i번째 줄의 왼쪽에서 j번째 방에는 1 이상 N^2 이하의 수 A(i, j)가 적혀 있습니다. 어떤 방에 있을때, 상하좌우에 있는 다른 방으로 이동할 수 있습니다. 이동하려는 방이 존재해야 하며, 이동하려는 방에 적힌 숫자가 현재 방에 적힌 숫자보다 정확히 1 더 커야 합니다. 처음 어떤 수가 적힌 방에서 있어야 가장 많은 개수의 방을 이동할..
-
[Java] Collections.sort () VS Arrays.sort()Java 2022. 3. 10. 13:13
Collections.sort()와 Arrays.sort()는 정렬할 때 많이 사용하는 2가지 메서드입니다. 두 메서드는 정렬을 어떤 방식으로 진행할까요? Arrays.sort() 배열을 정렬할 때 사용합니다. Arrays.sort() 내부구조 /** * Sorts the specified array into ascending numerical order. * * Implementation note: The sorting algorithm is a Dual-Pivot Quicksort * by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm * offers O(n log(n)) performance on many data sets..
-
.gitignore 란 무엇인가?Git 2022. 3. 10. 10:28
Github에서 Repository를 보다 보면 .gitignore파일을 본 적이 있을 것입니다. 이번 글에서는 .gitignore가 어떤 역할을 하는지에 대해서 정리해보려 합니. .gitignore란? Git 버전 관리에서 제외할 파일 목록을 지정하는 파일입니다. Git으로 프로젝트를 관리할 때 그 프로젝트 안의 특정 파일들은 Git으로 관리할 필요가 없는 경우가 있습니다. 즉, 사용자가 원하지 않는 파일들을 자동적으로 git commit 대상에서 제외시켜 줍니다. Git으로 관리할 필요가 없는 파일들 - NodeJS-Express로 개발할 때 npm module 용량이 크기도 하고, 프로젝트를 clone 한 뒤 직접 npm install 하는 것이 더 효율적입니다. -Java 컴파일된(.class) ..
-
Upper_bound와 Lower_bound란?알고리즘/알고리즘 2022. 3. 10. 09:26
어떤 리스트에서 이분 탐색을 이용하여 특정 값을 찾을 때, 리스트가 중복된 값을 포함하고 있을 때 중복 값들을 전부 찾거나 또한 그 중복값들을 활용해서 문제를 해결하기 위해서 lower_bound, upper_bound를 사용하면 특정 target number 보다 크거나 같은 첫 번째 원소 인덱스, target number보다 큰 첫번째 원소의 인덱스를 찾을 수 있습니다. 이진 탐색을 이용하기 때문에 리스트는 항상 정렬되어 있어야 합니다. hashFunction을 이용하여 중복된 값들의 개수를 탐색하면 O(1)이라 훨씬 더 빠르게 탐색할 수 있을 것 같은데..?라는 생각이 들긴 합니다. 하지만 특정 구간의 범위를 지정하기 위해서는 유용하게 사용할 수 있을 것 같습니다. upper_bound 범위 [be..
-
9229. 한빈이와 Spot Mart - 자바(JAVA)알고리즘/SW Expert Academy 2022. 3. 10. 00:01
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AW8Wj7cqbY0DFAXN SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제 해석 마트에는 N개의 과자 봉지가 있으며, 각 과자 봉지는 a(i) 그램의 무게를 가집니다. 최대한 많은 과자 봉지를 고르고 싶으나 과자 두 봉지의 무게가 M 그램을 초과하면 무거워서 들고 다닐 수 없습니다. 단, 과자는 정확히 두 봉지 사야 합니다. 들고 다닐 수 있는 과자들의 최대 무게 합을 출력하세요. 입력 첫 번째 줄에 테스트 케이스의 수 TC 가 주어진다. 이후 TC 개의 테스트 케이..
-
[백준] 7562 : 나이트의 이동 - 자바(JAVA)알고리즘/백준 2022. 3. 9. 00:01
https://www.acmicpc.net/problem/7562 7562번: 나이트의 이동 체스판 위에 한 나이트가 놓여져 있다. 나이트가 한 번에 이동할 수 있는 칸은 아래 그림에 나와있다. 나이트가 이동하려고 하는 칸이 주어진다. 나이트는 몇 번 움직이면 이 칸으로 이동할 수 www.acmicpc.net 문제해석 나이트는 다음그림과 같이 이동할 수 있습니다. 나이트가 이동하려는 칸이 주어질때 나이트는 몇 번 움직여서 목적지로 이동할 수 있을까요? 입력 입력의 첫째 줄에는 테스트 케이스의 개수가 주어집니다. 각 테스트 케이스는 3줄로 이루어져 있습니다. 1. 체스판의 한 변의 길이 l 이 주어집니다. (체스판의 크기는 l x l 입니다) 2. 나이트가 현재 있는 칸이 주어집니다. 3. 나이트가 이동하..
-
1228. [S/W 문제해결 기본] 8일차 - 암호문1 - 자바(JAVA)알고리즘/SW Expert Academy 2022. 3. 8. 00:01
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14w-rKAHACFAYD SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제해석 원본 암호를 수정하고자 합니다. 암호를 수정하기 위해서는 특수 제작된 처리기로만 수정할 수 있습니다. 이 처리기는 다음과 같은 기능을 1개 제공합니다. 기능 I(삽입) x, y, s I는 삽입을 의미하며 x의 위치 바로 다음에 y개의 숫자를 삽입합니다. s는 덧붙일 숫자들입니다. 예시) I 3 2 123152 487651 입력 첫번째 줄 : 원본 암호문의 길이 N 두 번째 줄 : 원본 암호..