2015年8月28日

[LeetCode] 238 - Product of Array Except Self

摘要: Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv... 阅读全文

posted @ 2015-08-28 11:44 tuituji 阅读(134) 评论(0) 推荐(0) 编辑

[LeetCode] 199 - Binary Tree Right Side View

摘要: Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl... 阅读全文

posted @ 2015-08-28 11:41 tuituji 阅读(119) 评论(0) 推荐(0) 编辑

[LeetCode] 240 - Search a 2D Matrix II

摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted in asc... 阅读全文

posted @ 2015-08-28 11:19 tuituji 阅读(121) 评论(0) 推荐(0) 编辑

[LeetCode] 169 - Majority Element

摘要: Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文

posted @ 2015-08-28 11:17 tuituji 阅读(103) 评论(0) 推荐(0) 编辑

[LeetCode] 28 - Implement strStr()

摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.class Solution {public: ... 阅读全文

posted @ 2015-08-28 11:14 tuituji 阅读(78) 评论(0) 推荐(0) 编辑

[LeetCode] 27 - Remove Element

摘要: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文

posted @ 2015-08-28 11:11 tuituji 阅读(90) 评论(0) 推荐(0) 编辑

[LeetCode] 14 - Longest Common Prefix

摘要: Write a function to find the longest common prefix string amongst an array of strings.class Solution { public: string longestCommonPrefix(vect... 阅读全文

posted @ 2015-08-28 11:09 tuituji 阅读(140) 评论(0) 推荐(0) 编辑

[LeetCode] 9 - Palindrome Number

摘要: Determine whether an integer is a palindrome. Do this without extra space.class Solution { public: bool isPalindrome(int x) { if (x... 阅读全文

posted @ 2015-08-28 11:05 tuituji 阅读(117) 评论(0) 推荐(0) 编辑

[LeetCode] 7 - Reverse Integer

摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321class Solution {public: int reverse(int x) { in... 阅读全文

posted @ 2015-08-28 11:03 tuituji 阅读(100) 评论(0) 推荐(0) 编辑

[LeetCode] 2 - Add Two Numbers

摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文

posted @ 2015-08-28 10:59 tuituji 阅读(160) 评论(0) 推荐(0) 编辑

导航