LeetCode
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 解題紀錄LeetCode: 78-Subsets 解題紀錄
題目
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 解題紀錄LeetCode: 567-Permutation in String 解題紀錄
題目
Given two stringsRead More »LeetCode: 567-Permutation in String 解題紀錄s1
ands2
, returntrue
ifs2
contains a permutation ofs1
, orfalse
otherwise. In other words, returntrue
if one ofs1
's permutations is the substring ofs2
.
LeetCode: 389-Find the Difference 解題紀錄
題目
You are given two stringsRead More »LeetCode: 389-Find the Difference 解題紀錄s
andt
. Stringt
is generated by random shuffling strings
and then add one more letter at a random position. Return the letter that was added tot
.
LeetCode: 1305-All Elements in Two Binary Search Trees 解題紀錄
題目
Given two binary search treesRead More »LeetCode: 1305-All Elements in Two Binary Search Trees 解題紀錄root1
androot2
, return a list containing all the integers from both trees sorted in ascending order.
LeetCode: 941-Valid Mountain Array 解題紀錄
題目
Given an array of integersRead More »LeetCode: 941-Valid Mountain Array 解題紀錄arr
, returntrue
if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: