전체 글 74

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

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..

99클럽 코테 스터디 18일차 TIL 깊이/너비 우선 탐색(DFS/BFS)

# 오늘의 학습 키워드 깊이/너비 우선 탐색(DFS/BFS) # 오늘의 문제 https://leetcode.com/problems/increasing-order-search-tree/description/Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child. Example 1: Input: root = [5,3,6,2,4,null,8,1,null,null,null,7,9]Output: [1,null,2,null,..

반응형