LeetCode
liu15073458538
这个作者很懒,什么都没留下…
展开
-
27. Remove Element
Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-place w原创 2017-12-31 10:51:40 · 146 阅读 · 0 评论 -
205. Isomorphic Strings
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another ...原创 2018-02-10 16:03:15 · 170 阅读 · 0 评论 -
290. Word Pattern
Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. Exampl...原创 2018-02-10 15:38:07 · 178 阅读 · 0 评论 -
202. Happy Number
Write an algorithm to determine if a number is “happy”. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares o...原创 2018-02-09 11:14:08 · 135 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with the le原创 2018-01-03 10:49:01 · 157 阅读 · 0 评论 -
209. Minimum Size Subarray Sum
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn’t one, return 0 instead.For example, given the array原创 2018-01-03 10:15:36 · 176 阅读 · 0 评论 -
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. For example, Given [3,2,1,5,6,4] and k = 2, return 5. N原创 2018-01-02 20:59:25 · 144 阅读 · 0 评论 -
283. Move Zeroes
Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your funct原创 2018-01-02 16:46:59 · 140 阅读 · 0 评论 -
88. Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional原创 2017-12-31 21:35:24 · 157 阅读 · 0 评论 -
75. Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1,原创 2017-12-31 17:44:26 · 136 阅读 · 0 评论 -
80. Remove Duplicates from Sorted Array II
Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first five elemen原创 2017-12-31 16:45:21 · 149 阅读 · 0 评论 -
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.The function twoSum should return indices of the two numbers suc原创 2017-12-31 11:54:09 · 142 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modifying the i原创 2017-12-31 11:39:59 · 159 阅读 · 0 评论 -
242. Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false. Note: You may assume原创 2018-02-07 15:07:36 · 120 阅读 · 0 评论