
Leetcode
bob于
这个作者很懒,什么都没留下…
展开
-
Two Sum Leetcode Python Java
Two SumGiven 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 exactly one solution.Example:Giv原创 2016-06-27 16:23:52 · 339 阅读 · 0 评论 -
Pascal's Triangle Leetcode Python Java
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]Python:#coding:utf-8class原创 2016-06-20 16:34:56 · 302 阅读 · 0 评论 -
Populating Next Right Pointers in Each Node Python Java Leetcode
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If there原创 2016-06-20 08:06:33 · 317 阅读 · 0 评论 -
Distinct Subsequences Python
Given a string S and a string T, count the number of distinct subsequences ofT in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none原创 2016-06-20 07:23:30 · 345 阅读 · 0 评论 -
Leetcode FlattenBinaryTree Java Python
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1 \原创 2016-06-19 08:57:53 · 285 阅读 · 0 评论 -
Leetcode path-sum-ii Python Java
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \原创 2016-06-19 08:30:25 · 376 阅读 · 0 评论 -
path-sum python java
java版:class TreeNode{ int val; TreeNode left; TreeNode right; void TreeNode(int val){ this.val=val; } }public class Solution{原创 2016-06-17 18:32:25 · 419 阅读 · 0 评论 -
3Sum Closest Leetcode Python Java
16. 3Sum ClosestTotal Accepted: 82615 Total Submissions: 279812 Difficulty: MediumGiven an array S of n integers, find three integers in S such that the sum is closest to a given n原创 2016-06-28 11:52:05 · 396 阅读 · 0 评论 -
3Sum Leetcode Python Java
3SumTotal Accepted: 125606 Total Submissions: 653184 Difficulty: MediumGiven an array S of n integers, are there elements a,b, c in S such that a + b + c = 0? Find all uniq原创 2016-06-28 11:15:55 · 340 阅读 · 0 评论 -
Longest Common Prefix Leetcode Python Java
Longest Common PrefixTotal Accepted: 107085 Total Submissions: 371911 Difficulty: EasyWrite a function to find the longest common prefix string amongst an array of strings.原创 2016-06-28 09:48:27 · 290 阅读 · 0 评论 -
Container With Most Water Leetcode Python Java
Container With Most WaterTotal Accepted: 82889 Total Submissions: 236099 Difficulty: MediumGiven n non-negative integers a1, a2, ...,an, where each represents a point at co原创 2016-06-28 09:23:55 · 303 阅读 · 0 评论 -
Palindrome Number Leetcode Python Java
Palindrome NumberTotal Accepted: 131143 Total Submissions: 406290 Difficulty: EasyDetermine whether an integer is a palindrome. Do this without extra space.Java:public原创 2016-06-28 08:22:49 · 289 阅读 · 0 评论 -
Reverse Integer Leetcode Python Java
Reverse IntegerTotal Accepted: 147726 Total Submissions: 622694 Difficulty: EasyReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321原创 2016-06-28 08:08:47 · 257 阅读 · 0 评论 -
Longest Palindromic Substring Leetcode Python Java
Longest Palindromic SubstringTotal Accepted: 115663 Total Submissions: 493295 Difficulty: MediumGiven a string S, find the longest palindromic substring in S. You may assume原创 2016-06-27 18:36:19 · 502 阅读 · 0 评论 -
Longest Substring Without Repeating Characters Leetcode Python Java
Longest Substring Without Repeating CharactersTotal Accepted: 159876 Total Submissions: 710693 Difficulty: MediumGiven a string, find the length of the longest substring with原创 2016-06-27 17:21:47 · 263 阅读 · 0 评论 -
Add Two Sum Leetcode Python java
Add Two NumbersTotal Accepted: 153367 Total Submissions: 644131 Difficulty: MediumYou are given two linked lists representing two non-negative numbers. The digits are stored原创 2016-06-27 16:58:56 · 298 阅读 · 0 评论 -
Pascal's Triangle II Leetcode Python java
Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Python:#coding:utf-8class Solution: def PascalTriangleii(self,k):原创 2016-06-20 16:39:27 · 267 阅读 · 0 评论