Python
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: 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: