- 博客(54)
- 资源 (2)
- 收藏
- 关注
原创 IOS/MAC环境下thrift的安装
本文参考博文:http://blog.csdn.net/yohunl/article/details/417485111、安装brew,安装过的可以sudo brew update一下。2、用brew安装thrift,sudo brew install thrift或者brew install thrift。3、建立链接,brew link thrift。4、如果3中出现link失
2015-07-09 10:17:10 511
原创 和大神们学习每天一题(leetcode)-Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB 特殊测试用
2015-01-24 10:51:48 405
原创 和大神们学习每天一题(leetcode)-Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...
2015-01-24 10:29:29 356
原创 和大神们学习每天一题(leetcode)-Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return[ ["aa"
2015-01-12 17:12:51 273
原创 和大神们学习每天一题(leetcode)-Compare Version Numbers
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and co
2014-12-25 09:44:02 388
原创 和大神们学习每天一题(leetcode)-Anagrams
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.本题并没有要求相关的回文字符串一定要放在一起,只需建立一个哈希表并对每个字符串排序后与哈希表里进行比较,就可以知道是否有变换字符串功能测试用例:"tr
2014-12-24 16:48:45 318
原创 和大神们学习每天一题(leetcode)-Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element
2014-12-24 09:46:33 262
原创 和大神们学习每天一题(leetcode)-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 digit. Add the two numbers and return it as a link
2014-12-23 10:30:30 376
原创 和大神们学习每天一题(leetcode)-4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Element
2014-12-23 09:34:09 254
原创 和大神们学习每天一题(leetcode)-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
2014-12-22 14:21:58 299
原创 和大神们学习每天一题(leetcode)-3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c
2014-12-22 10:22:09 333
原创 和大神们学习每天一题(leetcode)-Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe
2014-12-18 11:15:40 431
原创 和大神们学习每天一题(leetcode)-Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota
2014-12-16 09:45:10 304
原创 和大神们学习每天一题(leetcode)-Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on
2014-12-15 10:52:48 339
原创 和大神们学习每天一题(leetcode)-Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),
2014-12-15 10:17:13 285
原创 和大神们学习每天一题(leetcode)-Insertion Sort List
Sort a linked list using insertion sort.本题采用的是新建一个头结点,向新建的头结点中插入新的元素功能测试用例:{ 0, 2, 5, 3, 6, 10}特殊输入测试用例:NULL, {0}class Solution {public: ListNode *insertionSortList(ListNode *head) { if
2014-12-09 17:29:54 387
原创 和大神们学习每天一题(leetcode)-Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially fille
2014-12-09 10:27:23 315
原创 和大神们学习每天一题(leetcode)-Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is
2014-12-09 09:19:02 361
原创 和大神们学习每天一题(leetcode)-Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.class Solution {public: ListNode *mergeTwoLists(List
2014-12-08 15:37:55 316
原创 和大神们学习每天一题(leetcode)-Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.class Solution {pu
2014-12-08 14:44:21 348
原创 和大神们学习每天一题(leetcode)-Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?不说多了,斐波那契函数!class Soluti
2014-12-08 11:48:30 354
原创 和大神们学习每天一题(leetcode)-Implement strStr()
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题意是在一个字符串中查找目标字符串的第一个位置,如果没有返回-1。这道题虽然题意很简单,但是细节较多,需要考虑目标字符串为空的情
2014-12-08 09:20:27 315
原创 和大神们学习每天一题(leetcode)-Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.class Solution {publi
2014-12-07 20:51:22 402
原创 和大神们学习每天一题(leetcode)-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 matter what you leave beyond the new length.c
2014-12-07 17:45:47 281
原创 和大神们学习每天一题(leetcode)-Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
2014-12-07 17:24:28 255
原创 和大神们学习每天一题(leetcode)-Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from
2014-12-07 16:44:22 282
原创 和大神们学习每天一题(leetcode)-Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va
2014-12-07 16:00:10 288
原创 和大神们学习每天一题(leetcode)-Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe
2014-12-07 15:08:20 309
原创 和大神们学习每天一题(leetcode)-Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.class Solution{public: int minD
2014-12-05 10:14:34 241
原创 和大神们学习每天一题(leetcode)-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.class Solution{public: in
2014-12-05 10:03:01 188
原创 和大神们学习每天一题(leetcode)-Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum
2014-12-05 09:45:22 292
原创 和大神们学习每天一题(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
2014-12-04 12:01:55 201
原创 和大神们学习每天一题(leetcode)-Pascal's Triangle II
Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?class Solu
2014-12-04 10:15:03 260
原创 和大神们学习每天一题(leetcode)-Pascal's Triangle
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]]class Solution {public: v
2014-12-04 10:08:40 206
原创 和大神们学习每天一题(leetcode)-Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a
2014-12-03 10:32:11 327
原创 和大神们学习每天一题(leetcode)-Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.本文以逐次比较的方法找出最大公共序列class Solution {public: string longestCommonPrefix(vector &strs) { int nStrsNum = str
2014-12-02 09:42:41 247
原创 和大神们学习每天一题(leetcode)-Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.I - 1V - 5X - 10L - 50C - 100D - 500M - 1000If a lower
2014-12-01 10:23:28 205
原创 和大神们学习每天一题(leetcode)-Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘
2014-11-30 11:46:11 315
原创 和大神们学习每天一题(leetcode)-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
2014-11-27 11:10:21 376
原创 和大神们学习每天一题(leetcode)-Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7},
2014-11-26 12:45:56 336
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人