08 2016 档案

【LeetCode】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", 阅读全文

posted @ 2016-08-31 14:50 医生工程师 阅读(158) 评论(0) 推荐(0)

【LeetCode】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 l 阅读全文

posted @ 2016-08-31 10:14 医生工程师 阅读(181) 评论(0) 推荐(0)

【LeetCode】350. Intersection of Two Arrays II 解题小结
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. 相比较I,这个题目允许答案 阅读全文

posted @ 2016-08-31 05:38 医生工程师 阅读(144) 评论(0) 推荐(0)

【LeetCode】136. Single Number 解题小结
摘要:题目: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime com 阅读全文

posted @ 2016-08-31 04:59 医生工程师 阅读(145) 评论(0) 推荐(0)

【LeetCode】 349. Intersection of Two Arrays 解题小结
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. 第一次做的时候先将nums1存储 阅读全文

posted @ 2016-08-30 23:33 医生工程师 阅读(434) 评论(0) 推荐(0)

【LeetCode】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 occurr 阅读全文

posted @ 2016-08-29 23:48 医生工程师 阅读(105) 评论(0) 推荐(0)

【LeetCode】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 阅读全文

posted @ 2016-08-29 01:01 医生工程师 阅读(116) 评论(0) 推荐(0)

【LeetCode】2. Add Two Numbers 解题小结
摘要:题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sin 阅读全文

posted @ 2016-08-28 14:12 医生工程师 阅读(121) 评论(0) 推荐(0)

【LeetCode】18. 4Sum 解题小结
摘要:题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array 阅读全文

posted @ 2016-08-28 11:50 医生工程师 阅读(1206) 评论(0) 推荐(0)

【LeetCode】 16. 3Sum Closest 解题小结
摘要:题目:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three intege 阅读全文

posted @ 2016-08-28 09:58 医生工程师 阅读(167) 评论(0) 推荐(0)

【LeeCode】 15. 3Sum 解题小结
摘要:题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum 阅读全文

posted @ 2016-08-27 22:40 医生工程师 阅读(147) 评论(0) 推荐(0)

【LeetCode】11. Container With Most Water 解题小结
摘要:题目: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e 阅读全文

posted @ 2016-08-27 15:34 医生工程师 阅读(184) 评论(0) 推荐(0)

【LeetCode】81. Search in Rotated Sorted Array II
摘要:题目: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a fun 阅读全文

posted @ 2016-08-27 14:50 医生工程师 阅读(134) 评论(0) 推荐(0)

【LeetCode】33. Search in Rotated Sorted Array 解题小结
摘要:题目: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a targe 阅读全文

posted @ 2016-08-27 10:43 医生工程师 阅读(139) 评论(0) 推荐(0)

【LeetCode】217. Contains Duplicate 解题小结
摘要:题目: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the 阅读全文

posted @ 2016-08-27 10:24 医生工程师 阅读(118) 评论(0) 推荐(0)

【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 only permitted to complete at most one transac 阅读全文

posted @ 2016-08-26 17:49 医生工程师 阅读(116) 评论(0) 推荐(0)

【LeetCode】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, 阅读全文

posted @ 2016-08-26 16:51 医生工程师 阅读(117) 评论(0) 推荐(0)

【LeetCode】119. Pascal's Triangle II QuestionEditorial Solution 解题小结
摘要:题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. 思路大概是一步一步从后往前算出每行的各个元素。 阅读全文

posted @ 2016-08-26 15:33 医生工程师 阅读(146) 评论(0) 推荐(0)

【LeetCode】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 spac 阅读全文

posted @ 2016-08-26 05:19 医生工程师 阅读(115) 评论(0) 推荐(0)

【LeetCode】189. Rotate Array 解题小结
摘要:题目: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 阅读全文

posted @ 2016-08-25 22:32 医生工程师 阅读(95) 评论(0) 推荐(0)

【LeetCode】1. Two Sum 解题小结
摘要:题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have 阅读全文

posted @ 2016-08-23 16:39 医生工程师 阅读(290) 评论(0) 推荐(0)

【LeetCode】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, y 阅读全文

posted @ 2016-08-23 15:53 医生工程师 阅读(99) 评论(0) 推荐(0)

【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. You may assume that 阅读全文

posted @ 2016-08-23 13:26 医生工程师 阅读(127) 评论(0) 推荐(0)

【LeetCode】66. Plus One 解题小结
摘要:题目:Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit i 阅读全文

posted @ 2016-08-23 09:51 医生工程师 阅读(119) 评论(0) 推荐(0)

【LeetCode】Contains Duplicate II 解题小结
摘要:题目:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and t 阅读全文

posted @ 2016-08-23 03:35 医生工程师 阅读(715) 评论(0) 推荐(0)

导航