LeetCode: 383-Counting Bits 解題紀錄
題目
Given an integerRead More »LeetCode: 383-Counting Bits 解題紀錄n
, return an arrayans
of lengthn + 1
such that for eachi
(0 <= i <= n
),ans[i]
is the number of1
's in the binary representation ofi
.
Given an integerRead More »LeetCode: 383-Counting Bits 解題紀錄n
, return an arrayans
of lengthn + 1
such that for eachi
(0 <= i <= n
),ans[i]
is the number of1
's in the binary representation ofi
.
Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a value (Read More »LeetCode: 133-Clone Graph 解題思路int
) and a list (List[Node]
) of its neighbors.
Given a string columnTitle
that represents the column title as appear in an Excel sheet, return its corresponding column number.
Read More »LeetCode: 171-Excel Sheet Column Number 解題紀錄Given an arrayRead More »LeetCode: 169-Majority Element 解題紀錄nums
of sizen
, return the majority element. The majority element is the element that appears more than⌊n / 2⌋
times. You may assume that the majority element always exists in the array.
priority_queue(優先權佇列)是 C++ 標準模板函式庫(Standard Template Library, STL)中所提供的佇列容器,會優先返回優先權最高的元素。
Read More »[C++] STL 中的 priority_queue 優先權佇列筆記Given string num representing a non-negative integerRead More »LeetCode: 402-Remove K Digits 解題紀錄num
, and an integerk
, return the smallest possible integer after removingk
digits fromnum
.
Given a non-empty array of integers nums
, every element appears twice except for one. Find that single one.
You must implement a solution with a linear runtime complexity and use only constant extra space.
Read More »LeetCode: 136-Single Number 解題紀錄Given an integer array nums
of unique elements, return all possible subsets (the power set).
The solution set must not contain duplicate subsets. Return the solution in any order.
Read More »LeetCode: 78-Subsets 解題紀錄