LeetCode
LeetCode: 2215-Find the Difference of Two Arrays 解題紀錄
題目
Given two 0-indexed integer arrays nums1
and nums2
, return a list answer
of size 2
where:
answer[0]
is a list of all distinct integers innums1
which are not present innums2
.answer[1]
is a list of all distinct integers innums2
which are not present innums1
.
LeetCode: 1822-Sign of the Product of an Array 解題紀錄
題目
There is a function signFunc(x)
that returns:
LeetCode: 2336-Smallest Number in Infinite Set 解題紀錄
題目
You have a set which contains all positive integers [1, 2, 3, 4, 5, ...]
.
Implement the SmallestInfiniteSet
class:
LeetCode: 1768-Merge Strings Alternately 解題紀錄
題目
You are given two strings word1
and word2
. Merge the strings by adding letters in alternating order, starting with word1
. If a string is longer than the other, append the additional letters onto the end of the merged string.
LeetCode: 1431-Kids With the Greatest Number of Candies 解題紀錄
題目
There are n
kids with candies. You are given an integer array candies
, where each candies[i]
represents the number of candies the ith
kid has, and an integer extraCandies
, denoting the number of extra candies that you have.
LeetCode: 946-Validate Stack Sequences 解題紀錄
題目
Given two integer arrays pushed
and popped
each with distinct values, return true
if this could have been the result of a sequence of push and pop operations on an initially empty stack, or false
otherwise.
LeetCode: 2390-Removing Stars From a String 解題紀錄
題目
ou are given a string s
, which contains stars *
.
In one operation, you can:
Read More »LeetCode: 2390-Removing Stars From a String 解題紀錄LeetCode: 1857-Largest Color Value in a Directed Graph 解題紀錄
題目
There is a directed graph of n
colored nodes and m
edges. The nodes are numbered from 0
to n - 1
.