算法leetcode
文章平均质量分 78
sysu_CN
这个作者很懒,什么都没留下…
展开
-
算法分析与设计——LeetCode:101. Symmetric Tree
题目Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But t...原创 2018-03-06 13:55:24 · 195 阅读 · 0 评论 -
算法分析与设计——LeetCode:39. Combination Sum
题目Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from...原创 2018-01-03 15:07:04 · 294 阅读 · 0 评论 -
算法分析与设计——LeetCode:617. Merge Two Binary Trees
题目Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tree...原创 2017-12-29 19:57:19 · 210 阅读 · 0 评论 -
算法分析与设计——LeetCode:33. Search in Rotated Sorted Array
题目Suppose an array sorted in ascending order 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 target value to search. If found in the...原创 2017-12-27 21:22:42 · 214 阅读 · 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 integers. You may assume that each input would have exact...原创 2017-11-02 20:10:36 · 281 阅读 · 0 评论 -
算法分析与设计——LeetCode:6. ZigZag Conversion
题目The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I ...原创 2017-10-13 15:20:34 · 241 阅读 · 0 评论 -
算法分析与设计——LeetCode:5. Longest Palindromic Substring
题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Example:...原创 2017-10-04 19:32:30 · 289 阅读 · 0 评论 -
算法分析与设计——LeetCode:4. Median of Two Sorted Arrays
题目There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1:nums1 = [1, 3]num...原创 2017-10-02 15:11:46 · 219 阅读 · 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 length is 3.Given "bbbbb", the answer is "b", with the...原创 2017-09-24 16:23:16 · 269 阅读 · 0 评论 -
算法分析与设计——LeetCode:198. House Robber
题目You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent hou...原创 2018-01-03 16:34:26 · 411 阅读 · 0 评论 -
算法分析与设计——LeetCode:46. Permutations
题目Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]class...原创 2018-01-09 13:43:15 · 372 阅读 · 0 评论 -
算法分析与设计——LeetCode:104. Maximum Depth of Binary Tree
题目Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for a binary tree node...原创 2018-01-20 23:00:42 · 194 阅读 · 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 complexity. Could you implement it without using extra m...原创 2018-01-20 22:46:29 · 270 阅读 · 0 评论 -
算法分析与设计——LeetCode:23. Merge k Sorted Lists
题目Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next...原创 2018-01-20 22:40:52 · 262 阅读 · 0 评论 -
算法分析与设计——LeetCode:24. Swap Nodes in Pairs
题目Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constan...原创 2018-01-20 21:33:00 · 197 阅读 · 0 评论 -
算法分析与设计——LeetCode:63. Unique Paths II
题目Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.For...原创 2018-01-13 13:23:24 · 256 阅读 · 0 评论 -
算法分析与设计——LeetCode:62. Unique Paths
题目A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo...原创 2018-01-13 12:42:55 · 346 阅读 · 0 评论 -
算法分析与设计——LeetCode:55. Jump Game
题目Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you ...原创 2018-01-11 13:56:47 · 278 阅读 · 0 评论 -
算法分析与设计——LeetCode:47. Permutations II
题目Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[ [1,1,2], [1,2,1], [2,1,1]]cla...原创 2018-01-09 21:25:07 · 178 阅读 · 0 评论 -
算法分析与设计——LeetCode:2.Add Two Numbers
题目You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retu...原创 2017-09-11 18:57:01 · 342 阅读 · 0 评论