C++
LeetCode: 2244-Minimum Rounds to Complete All Tasks 解題紀錄
題目
You are given a 0-indexed integer array tasks
, where tasks[i]
represents the difficulty level of a task. In each round, you can complete either 2 or 3 tasks of the same difficulty level.
LeetCode: 944-Delete Columns to Make Sorted 解題紀錄
題目
You are given an array of n
strings strs
, all of the same length.
LeetCode: 797-All Paths From Source to Target 解題紀錄
題目
Given a directed acyclic graph (DAG) of n
nodes labeled from 0
to n - 1
, find all possible paths from node 0
to node n - 1
and return them in any order.
LeetCode: 1962-Remove Stones to Minimize the Total 解題紀錄
題目
You are given a 0-indexed integer array piles
, where piles[i]
represents the number of stones in the ith
pile, and an integer k
. You should apply the following operation exactly k
times:
LeetCode: 2279-Maximum Bags With Full Capacity of Rocks 解題紀錄
題目
You have n
bags numbered from 0
to n - 1
. You are given two 0-indexed integer arrays capacity
and rocks
. The ith
bag can hold a maximum of capacity[i]
rocks and currently contains rocks[i]
rocks. You are also given an integer additionalRocks
, the number of additional rocks you can place in any of the bags.
LeetCode: 55-Jump Game 解題紀錄
題目
You are given an integer array nums
. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position.
LeetCode: 309-Best Time to Buy and Sell Stock with Cooldown 解題紀錄
題目
You are given an array prices
where prices[i]
is the price of a given stock on the ith
day.
LeetCode: 841-Keys and Rooms 解題紀錄
題目
There are n
rooms labeled from 0
to n - 1
and all the rooms are locked except for room 0
. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.
LeetCode: 1971-Find if Path Exists in Graph 解題紀錄
題目
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 by at most one edge, and no vertex has an edge to itself.