原创 【數學】A077_LC_檢查「好數組」(裴蜀定理)

一、Problem Given an array nums of positive integers. Your task is to select some subset of nums, multiply each eleme

原创 【並查集】B008_LC_等式方程的可滿足性(互斥)

一、Problem Given an array equations of strings that represent relationships between variables, each string equations

原创 【字符串】B049_LC_子串的最大出現次數(暴力 / 位運算)

一、Problem Given a string s, return the maximum number of ocurrences of any substring under the following rules: The

原创 【位運算】B010_LC_字母組合迭代器(二進制枚舉)

一、Problem Design an Iterator class, which has: A constructor that takes a string characters of sorted distinct lowe

原创 【字符串】A050_LC_子串的最大出現次數(暴力 / 字符串 hash)

一、Problem Return the number of distinct non-empty substrings of text that can be written as the concatenation of so

原创 【數學】B076_LC_愛喫香蕉的珂珂(二分 + 向上取整)

一、Problem Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards

原创 【線性 dp】A004_LC_給房子塗色 III(三維記憶化 / dp)

一、Problem There is a row of m houses in a small city, each house must be painted with one of the n colors (labeled

原创 【棧】A014_LC_刪除無效的括號(bfs / dfs(代辦))

一、Problem Remove the minimum number of invalid parentheses in order to make the input string valid. Return all poss

原创 【數學】B075_LC_使結果不超過閾值的最小除數(二分)

一、Problem Given an array of integers nums and an integer threshold, we will choose a positive integer divisor and d

原创 【回溯】B059_LC_三數之和(雙指針 + 二分思想)

一、Problem Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all u

原创 【回溯】A064_LC_口算難題(暴搜 / 預處理權值)

一、Problem Given an equation, represented by words on left side and the result on right side. You need to check if t

原创 【回溯】B065_LC_串聯字符串的最大長度(二進制 (枚舉 / 遞歸))

一、Problem Given an array of strings arr. String s is a concatenation of a sub-sequence of arr which have unique cha

原创 【設計】B003_LC_設計瀏覽器歷史記錄(記錄 last 位置)

一、Problem You have a browser of one tab where you start on the homepage and you can visit another url, get back in

原创 【前綴和】B002_LC_矩陣區域和(暴力 / 二維前綴和)

一、Problem 二、Solution 方法一:暴力 一開始把 dir 數組也弄出來的了,這是錯誤思想,因爲這裏需要將 tx 與 ty 一起判斷,而一起判斷會導致一個不合法就 pass 掉了,其實沒必要,直接用 min、ma

原创 【樹】B033_LC_祖父節點值爲偶數的節點和(遞歸)

一、Problem Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a