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:
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:
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 解題紀錄
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:
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.
Given aRead More »LeetCode: 290-Word Pattern 解題紀錄pattern
and a strings
, find ifs
follows the same pattern. Here follow means a full match, such that there is a bijection between a letter inpattern
and a non-empty word ins
.