C++
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
.
LeetCode: 133-Clone Graph 解題思路
題目
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.
LeetCode: 171-Excel Sheet Column Number 解題紀錄
題目
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 解題紀錄LeetCode: 169-Majority Element 解題紀錄
題目
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.
[C++] STL 中的 priority_queue 優先權佇列筆記
priority_queue(優先權佇列)是 C++ 標準模板函式庫(Standard Template Library, STL)中所提供的佇列容器,會優先返回優先權最高的元素。
Read More »[C++] STL 中的 priority_queue 優先權佇列筆記LeetCode: 402-Remove K Digits 解題紀錄
題目
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
.
LeetCode: 136-Single Number 解題紀錄
題目
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 解題紀錄