LeetCode
吉阿
这个作者很懒,什么都没留下…
展开
-
字符串匹配
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribe to see which companies asked this question 28. Implement strStr()K原创 2016-09-10 20:22:45 · 277 阅读 · 0 评论 -
链表中与环相关的问题
141. Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?Subscribe to see which companies asked this question题目链接利用一个快指针,一个慢指针原创 2016-09-14 09:28:06 · 222 阅读 · 0 评论 -
Binary Tree Traversal(Preorder, Inorder, Postorder )
Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3].Note: Recursive solution is tri原创 2016-09-19 10:41:03 · 428 阅读 · 0 评论 -
90. Subsets II
Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,2], a solution is:原创 2016-09-19 10:25:36 · 200 阅读 · 0 评论 -
LeetCode 120. Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle [ [2], [3原创 2016-09-05 18:37:39 · 172 阅读 · 0 评论 -
LeetCode 34. Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target is not found in the ar原创 2016-09-04 21:51:43 · 191 阅读 · 0 评论 -
LeetCode 74. Search a 2D Matrix
74. Search a 2D MatrixWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right. The first原创 2016-09-04 15:45:44 · 193 阅读 · 0 评论 -
32. Longest Valid Parentheses
Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which has原创 2016-09-14 10:03:53 · 219 阅读 · 0 评论 -
78. Subsets
Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,3], a solution is: [ [3], [1],原创 2016-09-14 09:37:58 · 272 阅读 · 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原创 2016-09-11 23:14:54 · 175 阅读 · 0 评论 -
139. Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given s = “leetcode”, dict = [“leet”, “co原创 2016-09-19 21:19:47 · 273 阅读 · 0 评论