- 博客(54)
- 收藏
- 关注
原创 leetcode:257 Binary Tree Paths-每日编程第四十五题
Binary Tree PathsTotal Accepted: 27476 Total Submissions: 108456 Difficulty: EasyGiven a binary tree, return all root-to-leaf paths.For example, given the following binary tree:
2015-12-29 14:48:47 513
原创 leetcode:234 Palindrome Linked List-每日编程第四十四题
Palindrome Linked ListTotal Accepted: 31409 Total Submissions: 122659 Difficulty: EasyGiven a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n)
2015-12-29 13:50:05 403
原创 leetcode:67 Add Binary-每日编程第四十三题
Add BinaryTotal Accepted: 67578 Total Submissions: 261262 Difficulty: EasyGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "1
2015-12-29 11:22:31 424
原创 leetcode:14 Longest Common Prefix-每日编程第四十二题
Longest Common PrefixTotal Accepted: 78873 Total Submissions: 295144 Difficulty: EasyWrite a function to find the longest common prefix string amongst an array of strings.class Solut
2015-12-29 11:15:26 347
原创 leetcode:299 Bulls and Cows-每日编程第四十一题
Bulls and CowsTotal Accepted: 12776 Total Submissions: 47566 Difficulty: EasyYou are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend
2015-12-29 11:13:21 530
原创 leetcode:203 Remove Linked List Elements-每日编程第四十题
Remove Linked List ElementsTotal Accepted: 44897 Total Submissions: 165785 Difficulty: EasyRemove all elements from a linked list of integers that have value val.ExampleGiven: 1 --
2015-12-28 21:46:48 321
原创 leetcode:290 Word Pattern-每日编程第三十九题
Word PatternTotal Accepted: 19405 Total Submissions: 71219 Difficulty: EasyGiven a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such
2015-12-28 20:19:28 341
原创 leetcode:205 Isomorphic Strings-每日编程第三十八题
Isomorphic StringsTotal Accepted: 39963 Total Submissions: 145129 Difficulty: EasyGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the charac
2015-12-28 19:54:58 300
原创 leetcode:20 Valid Parentheses-每日编程第三十七题
Valid ParenthesesTotal Accepted: 84022 Total Submissions: 301663 Difficulty: EasyGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input s
2015-12-26 20:48:19 316
原创 leetcode:19 Remove Nth Node From End of List-每日编程第三十六题
Remove Nth Node From End of ListTotal Accepted: 86119 Total Submissions: 307466 Difficulty: EasyGiven a linked list, remove the nth node from the end of list and return its head.For
2015-12-26 20:33:47 301
原创 leetcode:219 Contains Duplicate II-每日编程第三十五题
Contains Duplicate IITotal Accepted: 38552 Total Submissions: 137098 Difficulty: EasyGiven an array of integers and an integer k, find out whether there are two distinct indices i and j in
2015-12-26 19:52:44 336
原创 leetcode:58 Length of Last Word-每日编程第三十四题
Length of Last WordTotal Accepted: 76106 Total Submissions: 269840 Difficulty: EasyGiven a string s consists of upper/lower-case alphabets and empty space characters ' ', return the le
2015-12-26 19:35:25 307
原创 leetcode:223 Rectangle Area-每日编程第三十三题
Valid SudokuTotal Accepted: 25744 Total Submissions: 91222 Difficulty: EasyFind the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by it
2015-12-24 16:52:12 403
原创 leetcode:190 Reverse Bits-每日编程第三十二题
Reverse BitsTotal Accepted: 46760 Total Submissions: 160246 Difficulty: EasyReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary
2015-12-24 16:03:58 371
原创 leetcode:88 Merge Sorted Array-每日编程第三十一题
Merge Sorted ArrayTotal Accepted: 80108 Total Submissions: 271926 Difficulty: EasyGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.思路:
2015-12-24 15:58:05 296
原创 leetcode:111 Minimum Depth of Binary Tree-每日编程第三十题
Minimum Depth of Binary TreeTotal Accepted: 84968 Total Submissions: 285784 Difficulty: EasyGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along
2015-12-24 15:35:30 291
原创 leetcode:160 Intersection of Two Linked Lists-每日编程第二十九题
Intersection of Two Linked ListsTotal Accepted: 53988 Total Submissions: 181510 Difficulty: EasyWrite a program to find the node at which the intersection of two singly linked lists begi
2015-12-15 22:17:55 288
原创 leetcode:9 Palindrome Number-每日编程第二十八题
Palindrome NumberTotal Accepted: 95160 Total Submissions: 317694 Difficulty: EasyDetermine whether an integer is a palindrome. Do this without extra space.思路:1).使用while(x/10>base),而不是while
2015-12-15 21:45:21 444
原创 leetcode:112 Path Sum-每日编程第二十七题
Path SumTotal Accepted: 81534 Total Submissions: 268857 Difficulty: EasyGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values alon
2015-12-15 21:14:25 300
原创 leetcode:225 Implement Stack using Queues-每日编程第二十六题
Binary Tree Level Order TraversalTotal Accepted: 25331 Total Submissions: 83601 Difficulty: EasyImplement the following operations of a stack using queues.push(x) -- Push element
2015-12-15 21:01:37 462
原创 leetcode:119 Pascal's Triangle II-每日编程第二十五题
Pascal's Triangle IITotal Accepted: 60120 Total Submissions: 196457 Difficulty: EasyGiven an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1
2015-12-15 20:42:21 275
原创 leetcode:172 Factorial Trailing Zeroes-每日编程第二十四题
Factorial Trailing ZeroesTotal Accepted: 44351 Total Submissions: 144160 Difficulty: EasyGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be
2015-12-15 20:32:12 351
原创 C++11 学习笔记 右值引用
一.右值引用C++11增加了一个新的类型,称为右值引用(R-value reference),标记为T &&。右值是指表达式结束后就不再存在的临时对象。相对应的左值就是指表达式结束后依然存在的持久对象,所有的具名变量或对象都是左值,而右值不具名。一个区分左值与右值的便捷方法是:看能不能对表达式取地址,如果能,则为左值。在C++11中,右值由两个概念构成,一个是将亡值(xvalue,expi
2015-12-15 09:59:57 759
原创 leetcode:118 Pascal's Triangle-每日编程第二十四题
Pascal's TriangleTotal Accepted: 66425Total Submissions: 210900Difficulty: EasyGiven numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[
2015-12-13 21:50:46 236
原创 leetcode:26 Remove Duplicates from Sorted Array-每日编程第二十三题
Remove Duplicates from Sorted ArrayTotal Accepted: 98385 Total Submissions:307605 Difficulty:EasyGiven a sorted array, remove the duplicates in place such that each element appear only
2015-12-13 21:32:53 376
原创 leetcode:198 House Robber-每日编程第二十二题
House RobberTotal Accepted: 44999Total Submissions: 140629 Difficulty: EasyYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money sta
2015-12-13 10:54:42 615
原创 C++11 学习笔记 列表初始化
一.列表初始化1.在C++98/03中,只有普通数组和POD类型(plain old data类型,可以直接使用memcpy复制的对象)可以用初始化列表来进行初始化。int i_arr[3] = { 1, 2, 3 };long l_arr[3] = { 1, 3, 2, 4 };struct A{ int x; int y;} a = { 1, 2 };
2015-12-11 18:51:01 811
原创 leetcode:27 Remove Element-每日编程第二十一题
Remove ElementTotal Accepted: 89646 Total Submissions: 276815 Difficulty: EasyGiven an array and a value, remove all instances of that value in place and return the new length.The or
2015-12-11 11:52:09 319
原创 leetcode:101 Symmetric Tree-每日编程第二十题
Symmetric TreeTotal Accepted: 83908 Total Submissions: 257485 Difficulty: EasyGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For exampl
2015-12-11 11:10:29 489
原创 leetcode:110 Balanced Binary Tree-每日编程第十九题
Balanced Binary TreeTotal Accepted: 85721 Total Submissions: 261445 Difficulty: EasyGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary
2015-12-11 10:46:13 259
原创 leetcode:231 Power of Two-每日编程第十八题
Power of TwoTotal Accepted: 42645 Total Submissions: 128399 Difficulty: EasyGiven an integer, write a function to determine if it is a power of two.思路:1).0可不是2的阶乘,因此,要在函数头判断输入是否为0。2).如果n
2015-12-11 10:34:40 210
原创 leetcode:21 Merge Two Sorted Lists-每日编程第十七题
Merge Two Sorted ListsTotal Accepted: 95133 Total Submissions: 281996 Difficulty: EasyMerge two sorted linked lists and return it as a new list. The new list should be made by splicing togethe
2015-12-11 10:14:35 253
原创 leetcode:232 Implement Queue using Stacks-每日编程第十六题
Implement Queue using StacksTotal Accepted: 26279 Total Submissions: 77749 Difficulty: EasyImplement the following operations of a queue using stacks.push(x) -- Push element x to the
2015-12-11 10:06:12 227
原创 C++11 学习笔记 模板的细节(右尖括号,using,函数模板默认参数)
一.模板的右尖括号在C++98/03的泛型编程中,模板实例化有一个很繁琐的地方,就是连续两个右尖括号(>>)会被编译解释成右移操作符,而不是模板参数表的形式。即template struct Foo{ typedef T type;};template class A{ // ....};int main(){ Foo>::type xx;/
2015-12-10 19:35:53 5168
原创 leetcode:70 Climbing Stairs-每日编程第十五题
Climbing StairsTotal Accepted: 83180 Total Submissions: 234611 Difficulty: EasyYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or
2015-12-10 14:42:01 285
原创 leetcode:206 Reverse Linked List-每日编程第十四题
Reverse Linked ListTotal Accepted: 65133 Total Submissions: 179691 Difficulty: EasyReverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursive
2015-12-10 14:41:28 236
原创 leetcode:191 Number of 1 Bits-每日编程第十三题
Number of 1 BitsTotal Accepted: 63943 Total Submissions: 169155 Difficulty: EasyWrite a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as t
2015-12-10 14:40:53 268
原创 leetcode:235 Lowest Common Ancestor of a Binary Search Tree-每日编程第十二题
Lowest Common Ancestor of a Binary Search TreeTotal Accepted: 41013 Total Submissions: 108082 Difficulty: Easy Given a binary search tree (BST), find the lowest common ancestor (LC
2015-12-10 14:40:09 225
原创 leetcode:169 Majority Element-每日编程第十一题
Majority ElementTotal Accepted: 78809 Total Submissions: 206122 Difficulty: EasyGiven an array of size n, find the majority element. The majority element is the element that appears mo
2015-12-10 14:39:32 332
原创 leetcode:171 Excel Sheet Column Number-每日编程第十题
Excel Sheet Column NumberTotal Accepted: 54683 Total Submissions: 140674 Difficulty: Easy Given a column title as appear in an Excel sheet, return its corresponding column number.
2015-12-10 14:38:48 213
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人