leetcode
xiaohahala
这个作者很懒,什么都没留下…
展开
-
leetcode Integer to Roman
Integer to RomanMy SubmissionsQuestion Solution Total Accepted: 43092 Total Submissions: 124603 Difficulty: MediumGiven an integer, convert it to a roman numeral.Input is g原创 2015-09-23 16:37:49 · 290 阅读 · 0 评论 -
leetcode Pascal's Triangle
Pascal's TriangleMy SubmissionsQuestion Solution Total Accepted: 57134 Total Submissions: 188533 Difficulty: EasyGiven numRows, generate the first numRows of Pascal's triangl原创 2015-09-16 14:52:34 · 280 阅读 · 0 评论 -
leetcode Intersection of Two Linked Lists My Submissions Question Solution Total Accepted: 43555 To
Intersection of Two Linked ListsMy SubmissionsQuestion Solution Total Accepted: 43555 Total Submissions: 149194 Difficulty: EasyWrite a program to find the node at which the原创 2015-09-16 19:14:39 · 278 阅读 · 0 评论 -
leetcode Min Stack
Min StackMy SubmissionsQuestion Solution Total Accepted: 44056 Total Submissions: 221468 Difficulty: EasyDesign a stack that supports push, pop, top, and retrieving the minim原创 2015-09-16 16:51:33 · 319 阅读 · 0 评论 -
leetcode Pascal's Triangle II
Pascal's Triangle IIMy SubmissionsQuestion Solution Total Accepted: 51715 Total Submissions: 175265 Difficulty: EasyGiven an index k, return the kth row of the Pascal's trian原创 2015-09-16 14:55:38 · 303 阅读 · 0 评论 -
leetcode Binary Tree Level Order Traversal
Binary Tree Level Order TraversalMy SubmissionsQuestion Solution Total Accepted: 65805 Total Submissions: 224736 Difficulty: EasyGiven a binary tree, return the level order t原创 2015-09-16 09:10:56 · 313 阅读 · 0 评论 -
leetcode Binary Tree Level Order Traversal II
Binary Tree Level Order Traversal IIMy SubmissionsQuestion Solution Total Accepted: 52308 Total Submissions: 167414 Difficulty: EasyGiven a binary tree, return the bottom-up原创 2015-09-16 09:33:17 · 271 阅读 · 0 评论 -
leetcode Maximum Depth of Binary Tree
Maximum Depth of Binary TreeMy SubmissionsQuestion Solution Total Accepted: 85301 Total Submissions: 188185 Difficulty: EasyGiven a binary tree, find its maximum depth.The原创 2015-09-16 09:23:56 · 293 阅读 · 0 评论 -
leetcode Same Tree
Same TreeMy SubmissionsQuestion Solution Total Accepted: 78688 Total Submissions: 189358 Difficulty: EasyGiven two binary trees, write a function to check if they are equal o原创 2015-09-14 20:20:12 · 221 阅读 · 0 评论 -
leetcode Path Sum
Path SumMy SubmissionsQuestion Solution Total Accepted: 69449 Total Submissions: 233406 Difficulty: EasyGiven a binary tree and a sum, determine if the tree has a root-to-lea原创 2015-09-16 14:48:44 · 288 阅读 · 0 评论 -
leetcode Valid Palindrome
Valid PalindromeMy SubmissionsQuestion Solution Total Accepted: 68173 Total Submissions: 309046 Difficulty: EasyGiven a string, determine if it is a palindrome, considering o原创 2015-09-16 16:06:03 · 321 阅读 · 0 评论 -
leetcode Balanced Binary Tree
Balanced Binary TreeMy SubmissionsQuestion Solution Total Accepted: 72116 Total Submissions: 225116 Difficulty: EasyGiven a binary tree, determine if it is height-balanced.原创 2015-09-16 10:04:56 · 270 阅读 · 0 评论 -
leetcode Container With Most Water
Container With Most WaterMy SubmissionsQuestion Solution Total Accepted: 52710 Total Submissions: 164550 Difficulty: MediumGiven n non-negative integers a1, a2, ..., an, wh原创 2015-09-23 16:03:51 · 320 阅读 · 0 评论 -
leetcode Longest Palindromic Substring
Longest Palindromic SubstringMy SubmissionsQuestion Solution Total Accepted: 70417 Total Submissions: 338025 Difficulty: MediumGiven a string S, find the longest palindromic原创 2015-09-22 16:24:54 · 347 阅读 · 0 评论 -
leetcode Median of Two Sorted Arrays
Median of Two Sorted ArraysMy SubmissionsQuestion Solution Total Accepted: 65547 Total Submissions: 383655 Difficulty: HardThere are two sorted arrays nums1 and nums2 of si原创 2015-09-21 16:23:17 · 289 阅读 · 0 评论 -
leetcode Word Ladder II
鉴于该题改了一晚上加一白天,我决定写篇博客纪念纪念。Word Ladder IIMy SubmissionsQuestionTotal Accepted: 33992 Total Submissions: 255558 Difficulty: HardGiven two words (beginWord and endWord), a原创 2015-11-06 16:45:44 · 624 阅读 · 0 评论 -
leetcode Permutation Sequence
Permutation SequenceMy SubmissionsQuestion Solution Total Accepted: 40746 Total Submissions: 174549 Difficulty: MediumThe set [1,2,3,…,n] contains a total of n! unique perm原创 2015-10-20 15:35:22 · 347 阅读 · 0 评论 -
leetcode Rotate Image
Rotate ImageYou are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Show TagsHa原创 2015-10-20 19:45:34 · 337 阅读 · 0 评论 -
leetcode Next Permutation
Next PermutationMy SubmissionsQuestion Solution Total Accepted: 48550 Total Submissions: 193196 Difficulty: MediumImplement next permutation, which rearranges numbers into th原创 2015-10-20 09:24:59 · 299 阅读 · 0 评论 -
leetcode Minimum Depth of Binary Tree
Minimum Depth of Binary TreeMy SubmissionsQuestion Solution Total Accepted: 70544 Total Submissions: 243160 Difficulty: EasyGiven a binary tree, find its minimum depth.The原创 2015-09-16 10:16:13 · 312 阅读 · 0 评论 -
leetcode Symmetric Tree
Symmetric TreeMy SubmissionsQuestion Solution Total Accepted: 70743 Total Submissions: 222922 Difficulty: EasyGiven a binary tree, check whether it is a mirror of itself (ie,原创 2015-09-15 10:39:50 · 322 阅读 · 0 评论 -
leetcode Merge Sorted Array
Merge Sorted ArrayMy SubmissionsQuestion Solution Total Accepted: 67179 Total Submissions: 231573 Difficulty: EasyGiven two sorted integer arrays nums1 and nums2, merge nums2原创 2015-09-14 19:51:29 · 270 阅读 · 0 评论 -
leetcode 70Climbing Stairs
Climbing StairsMy SubmissionsQuestion Solution Total Accepted: 68776 Total Submissions: 198955 Difficulty: EasyYou are climbing a stair case. It takes n steps to reach to the原创 2015-09-14 09:54:01 · 311 阅读 · 0 评论 -
[leetcode]Implement strStr()
Implement strStr() Total Accepted: 48184 Total Submissions: 218379My SubmissionsQuestion Solution Implement strStr().Returns the index of the first occurrence of needle in hays原创 2015-04-23 20:53:45 · 312 阅读 · 0 评论 -
leetcode之Longest Substring Without Repeating Characters
此题坑我啊,看了我上一篇转载的博客后,是有点思路了,但是尝试了写了后总是有一些情况没有考虑清楚。后来就直接把别人的答案看了看,也算看懂了吧,此处就写写别人是怎么实现的。首先变量说明:1、cur表示搜索到当前字符时,无重复子串的个数。例如:2、数组dp。dp[i]用来记录第i个字符,字符串长度。例如,搜索完毕的时候,dp数组的赋值如下,所以dp的长度与字符串长度相同。原创 2015-04-13 10:17:29 · 243 阅读 · 0 评论 -
[leetcode]Remove Element
Remove Element Total Accepted: 52603 Total Submissions: 162036My SubmissionsQuestion Solution Given an array and a value, remove all instances of that value in place and return t原创 2015-04-23 20:18:03 · 247 阅读 · 0 评论 -
[leetcode]Valid Parentheses
Valid Parentheses Total Accepted: 48447 Total Submissions: 182941My SubmissionsQuestion Solution Given a string containing just the characters '(', ')', '{', '}', '[' and ']',原创 2015-04-23 10:17:59 · 215 阅读 · 0 评论 -
[leetcode]Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the l原创 2015-04-23 08:51:30 · 222 阅读 · 0 评论 -
[leetcode]Merge Two Sorted Lists
Merge Two Sorted Lists Total Accepted: 53948 Total Submissions: 164362My SubmissionsQuestion Solution Merge two sorted linked lists and return it as a new list. The new list shou原创 2015-04-23 17:03:23 · 198 阅读 · 0 评论 -
[leetcode]Remove Duplicates from Sorted Array
Remove Duplicates from Sorted Array Total Accepted: 57505 Total Submissions: 182307My SubmissionsQuestion Solution Given a sorted array, remove the duplicates in place such that原创 2015-04-23 19:07:23 · 217 阅读 · 0 评论 -
leetcode之TwoSum问题
TwoSum问题:我的思路是,首先排序,然后使用二分查找查找问题。但是遇到一个问题,此处要输出的是下标,而经过排序后数组的下标变了,C++使用不熟练,map还不太理解,所以专门用了一个数组,专门用来存放下标。笨办法啦。#include "stdafx.h"#include #include #include using std::vector;v原创 2015-04-09 20:02:58 · 338 阅读 · 0 评论 -
leetcode之Reverse Integer
Reverse Integer Total Accepted: 66402 Total Submissions: 246671My SubmissionsQuestion Solution Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, r原创 2015-04-15 16:22:22 · 389 阅读 · 0 评论 -
leetcode之Palindrome Number
Palindrome Number Total Accepted: 52023 Total Submissions: 176072My SubmissionsQuestion Solution Determine whether an integer is a palindrome. Do this without extra space.click原创 2015-04-15 21:22:34 · 249 阅读 · 0 评论 -
leetcode之ZigZag Conversion
Zigzag:即循环对角线结构(0 8 16 1 79 1517 2 6 10 14 1原创 2015-04-15 15:06:02 · 289 阅读 · 0 评论 -
leetcode 67Add Binary
Add BinaryMy SubmissionsQuestion Solution Total Accepted: 55613 Total Submissions: 225733 Difficulty: EasyGiven two binary strings, return their sum (also a binary string).原创 2015-09-14 09:35:26 · 354 阅读 · 0 评论 -
leetcode Plus One
Plus One Total Accepted: 61952 Total Submissions: 205031My SubmissionsQuestion Solution Given a non-negative number represented as an array of digits, plus one to the number.Th原创 2015-09-11 16:38:36 · 265 阅读 · 0 评论 -
leetcode Length of Last Word
Length of Last Word Total Accepted: 64034 Total Submissions: 235032My SubmissionsQuestion Solution Given a string s consists of upper/lower-case alphabets and empty space charact原创 2015-09-11 15:53:04 · 252 阅读 · 0 评论 -
leetcode之Count and Say
这个题目关键是理解题目。别人是这样理解的。11个1,即112个1,即211个2,1个1,即1211,1个1,1个2,2个1,即111221,3个1,2个2,1个1,即312211The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211原创 2015-09-11 15:19:27 · 239 阅读 · 0 评论 -
leetcode36Valid Sudoku
// test36ValidSudoku.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "vector"#include "iostream"using std::cout;using std::endl;using std::vector;bool isValidSudoku(vector > &boa原创 2015-09-10 17:54:49 · 258 阅读 · 0 评论 -
[leetcode]Longest Common Prefix
Longest Common Prefix Total Accepted: 42918 Total Submissions: 164710My SubmissionsQuestion Solution Write a function to find the longest common prefix string amongst an array of原创 2015-04-16 16:55:01 · 187 阅读 · 0 评论