Now&Here
leetcode229 Majority Element II

leetcode#229 Majority Element II

Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.

leetcode169 Majority Element

leetcode#169 Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋ times.

leetcode167 Two Sum II - Input array is sorted

leetcode#167 Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.

leetcode119 Pascals Triangle II

leetcode#119 Pascals Triangle II

Given an index k, return the kth row of the Pascal’s triangle.

leetcode118 Pascal's Triangle

leetcode#118 Pascal’s Triangle

Given numRows, generate the first numRows of Pascal’s triangle.

leetcode88 Merge Sorted Array

leetcode#88 Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

leetcode66 Plus One

leetcode#66 Plus One

Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.

leetcode215 Kth Largest Element in an Array

leetcode#215 Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.

leetcode414 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 exist, return the maximum number. The time complexity must be in O(n).

leetcode268 Missing Number

leetcode#268 Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.