Til 38

99클럽 코테 스터디 29일차 TIL Missing Number

# 오늘의 학습 키워드 이분탐색 # 오늘의 문제 https://leetcode.com/problems/missing-number/description/ Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. Example 1:Input: nums = [3,0,1]Output: 2Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it doe..

99클럽 코테 스터디 28일차 TIL 프로세스

# 오늘의 학습 키워드 스택/큐 # 오늘의 문제 https://school.programmers.co.kr/learn/courses/30/lessons/42587문제 설명운영체제의 역할 중 하나는 컴퓨터 시스템의 자원을 효율적으로 관리하는 것입니다. 이 문제에서는 운영체제가 다음 규칙에 따라 프로세스를 관리할 경우 특정 프로세스가 몇 번째로 실행되는지 알아내면 됩니다.1. 실행 대기 큐(Queue)에서 대기중인 프로세스 하나를 꺼냅니다.2. 큐에 대기중인 프로세스 중 우선순위가 더 높은 프로세스가 있다면 방금 꺼낸 프로세스를 다시 큐에 넣습니다.3. 만약 그런 프로세스가 없다면 방금 꺼낸 프로세스를 실행합니다.  3.1 한 번 실행한 프로세스는 다시 큐에 넣지 않고 그대로 종료됩니다.예를 들어 프로세스 ..

카테고리 없음 2024.08.18

99클럽 코테 스터디 26일차 TIL 바탕화면 정리

# 오늘의 학습 키워드 시뮬레이션  # 오늘의 문제 https://school.programmers.co.kr/learn/courses/30/lessons/161990문제 설명코딩테스트를 준비하는 머쓱이는 프로그래머스에서 문제를 풀고 나중에 다시 코드를 보면서 공부하려고 작성한 코드를 컴퓨터 바탕화면에 아무 위치에나 저장해 둡니다. 저장한 코드가 많아지면서 머쓱이는 본인의 컴퓨터 바탕화면이 너무 지저분하다고 생각했습니다. 프로그래머스에서 작성했던 코드는 그 문제에 가서 다시 볼 수 있기 때문에 저장해 둔 파일들을 전부 삭제하기로 했습니다.컴퓨터 바탕화면은 각 칸이 정사각형인 격자판입니다. 이때 컴퓨터 바탕화면의 상태를 나타낸 문자열 배열 wallpaper가 주어집니다. 파일들은 바탕화면의 격자칸에 위치하..

99클럽 코테 스터디 25일차 TIL Find if Path Exists in Graph

# 오늘의 학습 키워드 그래프 # 오늘의 문제 https://leetcode.com/problems/find-if-path-exists-in-graph/description/There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges, where each edges[i] = [ui, vi] denotes a bi-directional edge between vertex ui and vertex vi. Every vertex pair is connected b..

99클럽 코테 스터디 24일차 TIL Find Center of Star Graph

# 오늘의 학습 키워드 그래프 # 오늘의 문제 https://leetcode.com/problems/find-center-of-star-graph/description/There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node.You are given a 2D integer array edges where each edges[i] = [ui, vi] indicates that there is an ..

99클럽 코테 스터디 23일차 TIL Array Partition

# 오늘의 학습 키워드 탐욕법(Greedy) # 오늘의 문제 https://leetcode.com/problems/array-partition/description/Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum. Example 1:Input: nums = [1,4,3,2]Output: 4Explanation: All possible pairings (ignoring the ordering of elements..

99클럽 코테 스터디 22일차 TIL Pascal's Triangle II

# 오늘의 학습 키워드 동적 계획법 # 오늘의 문제 https://leetcode.com/problems/pascals-triangle-ii/description/Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle.In Pascal's triangle, each number is the sum of the two numbers directly above it as shown:  Example 1:Input: rowIndex = 3Output: [1,3,3,1]Example 2:Input: rowIndex = 0Output: [1]Example 3:Input: rowIndex = 1Output: [..

99클럽 코테 스터디 21일차 TIL Pascal's Triangle

# 오늘의 학습 키워드 동적계획법 # 오늘의 문제 https://leetcode.com/problems/pascals-triangle/description/Given an integer numRows, return the first numRows of Pascal's triangle.In Pascal's triangle, each number is the sum of the two numbers directly above it as shown:  Example 1:Input: numRows = 5Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]Example 2:Input: numRows = 1Output: [[1]] # 나의 풀이방식 class Solution { ..

99클럽 코테 스터디 20일차 TIL 체육복

# 오늘의 학습 키워드 탐욕법(greedy) # 오늘의 문제 문제 설명점심시간에 도둑이 들어, 일부 학생이 체육복을 도난당했습니다. 다행히 여벌 체육복이 있는 학생이 이들에게 체육복을 빌려주려 합니다. 학생들의 번호는 체격 순으로 매겨져 있어, 바로 앞번호의 학생이나 바로 뒷번호의 학생에게만 체육복을 빌려줄 수 있습니다. 예를 들어, 4번 학생은 3번 학생이나 5번 학생에게만 체육복을 빌려줄 수 있습니다. 체육복이 없으면 수업을 들을 수 없기 때문에 체육복을 적절히 빌려 최대한 많은 학생이 체육수업을 들어야 합니다.전체 학생의 수 n, 체육복을 도난당한 학생들의 번호가 담긴 배열 lost, 여벌의 체육복을 가져온 학생들의 번호가 담긴 배열 reserve가 매개변수로 주어질 때, 체육수업을 들을 수 있는 ..

99클럽 코테 스터디 19일차 TIL 탐욕법(Greedy)

# 오늘의 학습 키워드 탐욕법(Greedy) # 오늘의 문제 https://school.programmers.co.kr/learn/courses/30/lessons/135808#문제 설명과일 장수가 사과 상자를 포장하고 있습니다. 사과는 상태에 따라 1점부터 k점까지의 점수로 분류하며, k점이 최상품의 사과이고 1점이 최하품의 사과입니다. 사과 한 상자의 가격은 다음과 같이 결정됩니다.한 상자에 사과를 m개씩 담아 포장합니다.상자에 담긴 사과 중 가장 낮은 점수가 p (1 ≤ p ≤ k)점인 경우, 사과 한 상자의 가격은 p * m 입니다.과일 장수가 가능한 많은 사과를 팔았을 때, 얻을 수 있는 최대 이익을 계산하고자 합니다.(사과는 상자 단위로만 판매하며, 남는 사과는 버립니다)예를 들어, k = 3..

반응형