摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2017-01-27 12:27 璨璨要好好学习 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x). Compute and return the square root of x. 小小的一道题竟然做了半天。。。= = 乘法啊加法啊reverse这些一定要考虑到越界的问题。 另外可以使用start + 1 < end的条件,这个时候一般跳出循环 阅读全文
posted @ 2017-01-27 05:58 璨璨要好好学习 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文
posted @ 2017-01-27 04:26 璨璨要好好学习 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: [ ["ate", "eat","tea"], [" 阅读全文
posted @ 2017-01-27 03:07 璨璨要好好学习 阅读(175) 评论(0) 推荐(0) 编辑