항해99
-
99클럽 코테 스터디 12일차 TIL + 뉴스 전하기(백준)Study(진행중)/항해99 2024. 8. 3. 02:03
오늘의 학습 키워드 - 알고리즘 - 정렬 - 그리디 - 트리 - DP공부한 내용 본인의 언어로 정리하기https://www.acmicpc.net/problem/1135예전에 스터디를 할 때 DP유형하는 주에 풀이를 봤었다.다만 그 주에 면접이 있어 문제를 풀지는 못했는데, 다시 봐도 어려운 문제라고 생각된다. 혼자 시도했었지만, 해당 방식이 틀렸기에 다른 사람의 코드를 찾아봤다.내가 시도했던 방법은 아래와 같다. 시도했던 방법1. 루트 노드부터 자식 노드까지 각각의 노드의 자식들이 몇 개의 자식 노드를 가지고있는지를 dfs를 이용해 계산한다.(현재 노드 기준 리프노드까지 모든 자식들의 숫자를 계산)2. 루트 노드부터 리프 노드까지 가장 자식을 많이 가지고 있는 노드를 bfs를 이용해 탐..
-
99클럽 코테 스터디 11일차 TIL + 가장 큰 수(프로그래머스)Study(진행중)/항해99 2024. 8. 2. 01:11
오늘의 학습 키워드 - 알고리즘 - 정렬공부한 내용 본인의 언어로 정리하기https://school.programmers.co.kr/learn/courses/30/lessons/42746문제를 간략히 설명하자면, 배열로 주어진 0부터 1000 사이의 숫자들을 활용해 가장 큰 수를 만드는 문제였다.그래서 정렬을 어떤 방식으로 할 지 열심히 고민해야 하는 문제였다. 개인적으로 풀이가 최적의 시간으로 풀었다고는 생각하지는 않았고, 다른 사람들의 풀이도 찾아봤지만나름 스스로 아이디어를 가지고 풀었기에 작성했다. 풀이 과정은 다음과 같다.1. 두 숫자의 각 자리수마다 비교해서 다르다면 큰 숫자를 return한다.2. 이 과정을 각 자리수의 곱만큼 반복한다(만약 123과 1234같은 형식이라면 최대 12번 ..
-
99클럽 코테 스터디 10일차 TIL + 최대 힙(백준)Study(진행중)/항해99 2024. 8. 1. 01:35
오늘의 학습 키워드 - 알고리즘 - 우선순위 큐공부한 내용 본인의 언어로 정리하기https://www.acmicpc.net/problem/11279우선순위 큐만 다룰 줄 알면 되는 문제였다.풀이 과정도 코드만 보면 이해되므로 생략하겠다. 코드는 다음과 같다.import java.io.*;import java.util.*;public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder sb = new StringBuilder(); static int n; public static void main(String[] arg..
-
99클럽 코테 스터디 9일차 TIL + 프로세스와 스레드, 코루틴Study(진행중)/항해99 2024. 7. 31. 02:11
오늘의 학습 키워드 - 운영체제 - 프로세스 - 스레드 - 코루틴공부한 내용 본인의 언어로 정리하기운영체제를 공부하다 보니 스레드와 프로세스 개념이 나왔고, 아직 강의를 다 듣지는 않았지만 그래도 면접에서 해당 질문을 받았던 적이 있고 그 때 대답을 재대로 하지 못해 정리해보려고 한다. 먼저 프로세스는 실행중인 프로그램이다(program in execution)그리고 프로그램은 하나의 실행 흐름이다(single thread of execution)그래서 OS의 작업의 단위는 프로세스이다. 그럼 멀티 프로세스와 멀티 스레드는 무엇일까? AI에게 물어봤다. 멀티프로세스 (Multiprocessing)멀티프로세스는 여러 개의 프로세스를 생성하여 작업을 병렬로 수행하는 방식입니다. 독립된 메모리:..
-
99클럽 코테 스터디 8일차 TIL + 베스트앨범(프로그래머스)Study(진행중)/항해99 2024. 7. 30. 00:46
오늘의 학습 키워드 - 알고리즘 - 구현 - 큐공부한 내용 본인의 언어로 정리하기https://school.programmers.co.kr/learn/courses/30/lessons/42579큐를 사용하는 구현 문제를 풀었다.마지막에 몇 번 까지 큐의 원소를 옮길 지 고민하는게 어려웠다. 풀이 과정은 다음과 같다.0. 만약 모든 원소들의 합이 홀수라면 -1을 반환한다.1 - 1. 2개의 큐에 각각의 원소들을 담는다1 - 2. 2개의 큐의 원소들의 합을 각각 구한다2. 두개의 큐 중 합이 큰 큐에서 작은 큐로 원소를 옮긴다3. 이를 전체 원소가 n개라면 3n - 2번 반복한다.3n - 2번 반복하는 이유는 큐에 원소를 하나만 남기고 다른 큐에 옮기는데 n - 1번의 연산이 필요하고이후 2n -..
-
99클럽 코테 스터디 7일차 TIL + 과제 진행하기(프로그래머스)Study(진행중)/항해99 2024. 7. 29. 02:01
오늘의 학습 키워드 - 알고리즘 - 구현 - 정렬 - 스택공부한 내용 본인의 언어로 정리하기https://school.programmers.co.kr/learn/courses/30/lessons/176962 정렬과 스택을 이용한 구현 알고리즘 문제를 풀었다.구현하는게 많이 까다로웠다. 풀이는 다음과 같다.import java.util.*;class Solution { class Task { String name; int leftTime; Task(String name, int leftTime) { this.name = name; this.leftTime = leftTime; } } public St..
-
99클럽 코테 스터디 6일차 TIL + 테이블 해시 함수(프로그래머스)Study(진행중)/항해99 2024. 7. 27. 22:40
오늘의 학습 키워드 - 알고리즘 - 구현공부한 내용 본인의 언어로 정리하기https://school.programmers.co.kr/learn/courses/30/lessons/42579 단순 구현 문제를 풀었다.문제를 푸는 시간은 얼마 안걸렸지만, 용어가 어려워서 이해하는데 좀 걸렸던 문제이다. 풀이는 다음과 같다.import java.util.*;class Solution { public int solution(int[][] data, int col, int row_begin, int row_end) { int column = col - 1; int rowBegin = row_begin - 1; int rowEnd = row_end - 1; ..
-
99클럽 코테 스터디 5일차 TIL + 베스트앨범(프로그래머스)Study(진행중)/항해99 2024. 7. 27. 00:53
오늘의 학습 키워드 - 알고리즘 - 구현 - 해시 - 우선순위 큐공부한 내용 본인의 언어로 정리하기스터디에 나온 삼성 기출 문제를 풀어보려 했는데 고민하다가 접근을 못해서 내일로 미뤘다.내일은 꼭 풀어봐야겠다. https://school.programmers.co.kr/learn/courses/30/lessons/42579해시와 우선순위 큐를 다루는 구현 알고리즘 문제를 풀었다.생각보다 구현하는게 까다로웠던 것 같다. 풀이 과정은 다음과 같다.1. 장르와 노래 정보를 저장하는 클래스 생성2. 장르가 처음 나왔다면 해당 장르에 별명(숫자)를 붙여주고 이를 Map으로 관리, 2 - 1. 해당 장르의 곡이 몇 번 나왔는지 계산하여 Map에 넣어줌3. 노래 장르별로 따로 관리 되는 우선순위 큐 배..