leetcode
-
LeetCode – 169. Majority Element
Given an array of size n, find the majority element. The majority element is the element that appear…
-
LeetCode – 219. Contains Duplicate II
Given an array of integers and an integer k, find out whether there are two distinct indices i and j…
-
LeetCode – 217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return t…
-
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 the…
-
LeetCode – 122. Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i. Design an al…
-
LeetCode – 121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were …
-
LeetCode – 88. Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:Yo…
-
LeetCode – 136. Single Number
Given an array of integers, every element appears twice except for one. Find that single one. Note:Y…
-
LeetCode – 26. Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and ret…
-
LeetCode – 27. Remove Element
Given an array and a value, remove all instances of that value in place and return the new length. D…
-
LeetCode – 35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the…
-
LeetCode – 459. Repeated Substring Pattern
Given a non-empty string check if it can be constructed by taking a substring of it and appending mu…
-
LeetCode – 422. Valid Word Square
Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a v…
-
LeetCode – 415. Add Strings
Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2…
-
LeetCode – 557. Reverse Words in a String III
Given a string, you need to reverse the order of characters in each word within a sentence while sti…