항해99 39

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클럽 코테 스터디 27일차 TIL 공원 산책

# 오늘의 학습 키워드 시뮬레이션 # 오늘의 문제 https://school.programmers.co.kr/learn/courses/30/lessons/172928문제 설명지나다니는 길을 'O', 장애물을 'X'로 나타낸 직사각형 격자 모양의 공원에서 로봇 강아지가 산책을 하려합니다. 산책은 로봇 강아지에 미리 입력된 명령에 따라 진행하며, 명령은 다음과 같은 형식으로 주어집니다.["방향 거리", "방향 거리" … ]예를 들어 "E 5"는 로봇 강아지가 현재 위치에서 동쪽으로 5칸 이동했다는 의미입니다. 로봇 강아지는 명령을 수행하기 전에 다음 두 가지를 먼저 확인합니다.주어진 방향으로 이동할 때 공원을 벗어나는지 확인합니다.주어진 방향으로 이동 중 장애물을 만나는지 확인합니다.위 두 가지중 어느 하나..

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가 매개변수로 주어질 때, 체육수업을 들을 수 있는 ..

반응형