摘要: Implementint sqrt(int x).Compute and return the square root ofx. 1 class Solution { 2 public: 3 int sqrt(int x) { 4 if (x mid) { // 不要用x ... 阅读全文
posted @ 2014-05-21 12:30 小菜刷题史 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Write a function to find the longest common prefix string amongst an array of strings. 1 class Solution { 2 public: 3 string longestCommonPrefix(v... 阅读全文
posted @ 2014-05-21 12:00 小菜刷题史 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文
posted @ 2014-05-21 11:42 小菜刷题史 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol... 阅读全文
posted @ 2014-05-21 11:11 小菜刷题史 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2014-05-21 10:46 小菜刷题史 阅读(106) 评论(0) 推荐(0) 编辑