Skip to content

C++

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.

Read More »LeetCode: 2279-Maximum Bags With Full Capacity of Rocks 解題紀錄

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.

Read More »LeetCode: 1971-Find if Path Exists in Graph 解題紀錄