C++
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:
LeetCode: 520-Detect Capital 解題紀錄
題目
We define the usage of capitals in a word to be right when one of the following cases holds:Read More »LeetCode: 520-Detect Capital 解題紀錄
LeetCode: 2149-Rearrange Array Elements by Sign 解題紀錄
題目
You are given a 0-indexed integer arrayRead More »LeetCode: 2149-Rearrange Array Elements by Sign 解題紀錄nums
of even length consisting of an equal number of positive and negative integers. You should rearrange the elements ofnums
such that the modified array follows the given conditions:
LeetCode: 605-Can Place Flowers 解題紀錄
題目
You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer arrayRead More »LeetCode: 605-Can Place Flowers 解題紀錄flowerbed
containing0
's and1
's, where0
means empty and1
means not empty, and an integern
, return ifn
new flowers can be planted in theflowerbed
without violating the no-adjacent-flowers rule.