[LeetCode] 2140. Solving Questions With Brainpower (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionYou are given a 0-indexed 2D integer array questions where questions[i] = [pointsi, brainpoweri]. The array describes the questions of an exam, where you have to process the questions in order (i.e., starting from question 0) and make a decision whether to solve or skip each question. Solving question i will earn you pointsi points but you will be unable to solve ea..
[Airflow] PythonOperator를 이용한 DAG 작성 및 실행
·
Data Engineering/Airflow
이번 글에서는 `Apache Airflow`에서 `DAG`를 작성하고 실행하는 방법에 대해 설명하려고 한다. 앞선 글에서 설명했듯이, `Airflow`는 `DAG(Directed Acyclic Graph)`를 이용해 작업의 실행 순서를 정의한다. 간단하게 이러한 `DAG`를 작성해보고 직접 실행해 볼 예정이다. 실습 환경OSUbuntu 20.04Docker28.0.4Apache Airflowairflow:2.10.5 실습은 Ubuntu 20.04 환경에서 진행했으며, Docker Compose를 활용하여 Airflow를 구성하였다.  DAG 작성DAG는 기본적으로 Python으로 작성되며 `dags/` 디렉토리에 작성하면 된다. Airflow는 해당 디렉토리 내의 Python 파일을 자동으로 인식하여 D..
[LeetCode] 2780. Minimum Index of a Valid Split (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionAn element x of an integer array arr of length m is dominant if more than half the elements of arr have a value of x. You are given a 0-indexed integer array nums of length n with one dominant element. You can split nums at an index i into two arrays nums[0, ..., i] and nums[i + 1, ..., n - 1], but the split is only valid if:0 nums[0, ..., i], and nums[i + 1, ..., n..
[LeetCode] 2033. Minimum Operations to Make a Uni-Value Grid (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionYou are given a 2D integer grid of size m x n and an integer x. In one operation, you can add x to or subtract x from any element in the grid. A uni-value grid is a grid where all the elements of it are equal. Return the minimum number of operations to make the grid uni-value. If it is not possible, return -1.  Problem ExampleExample 1:Input: grid = [[2,4],[6,8]], x..
[LeetCode] 3394. Check if Grid can be Cut into Sections (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionYou are given an integer n representing the dimensions of an n x n grid, with the origin at the bottom-left corner of the grid. You are also given a 2D array of coordinates rectangles, where rectangles[i] is in the form [startx, starty, endx, endy], representing a rectangle on the grid. Each rectangle is defined as follows:(startx, starty): The bottom-left corner of..
[LeetCode] 3169. Count Days Without Meetings (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionYou are given a positive integer days representing the total number of days an employee is available for work (starting from day 1). You are also given a 2D array meetings of size n where, meetings[i] = [start_i, end_i] represents the starting and ending days of meeting i (inclusive). Return the count of days when the employee is available for work but no meetings a..