LeetCode – 594. Longest Harmonious Subsequence

LeetCode – 594. Longest Harmonious Subsequence

We define a harmonious array is an array where the difference between its maximum value and its mini…

LeetCode –  575. Distribute Candies

LeetCode – 575. Distribute Candies

Given an integer array with even length, where different numbers in this array represent different k…

LeetCode – 566. Reshape the Matrix

LeetCode – 566. Reshape the Matrix

In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix …

LeetCode – 561. Array Partition I

LeetCode – 561. Array Partition I

Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1…

LeetCode – 532. K-diff Pairs in an Array

LeetCode – 532. K-diff Pairs in an Array

Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in t…

LeetCode – 496. Next Greater Element I

LeetCode – 496. Next Greater Element I

You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of n…

LeetCode – 485. Max Consecutive Ones

LeetCode – 485. Max Consecutive Ones

Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,…

LeetCode – 453. Minimum Moves to Equal Array Elements

LeetCode – 453. Minimum Moves to Equal Array Elements

Given a non-empty integer array of size n, find the minimum number of moves required to make all arr…

LeetCode – 448. Find All Numbers Disappeared in an Array

LeetCode – 448. Find All Numbers Disappeared in an Array

Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and ot…

LeetCode – 414. Third Maximum Number

LeetCode – 414. Third Maximum Number

Given a non-empty array of integers, return the third maximum number in this array. If it does not e…

返回顶部