随笔分类 -  LeetCode

摘要:Problem Definition: Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0-... 阅读全文
posted @ 2015-07-16 11:45 曾可爱 阅读(167) 评论(0) 推荐(0)
摘要:Problem Definition: Given an integer, write a function to determine if it is a power of two.Solution:class Solution: # @param {integer} n # @re... 阅读全文
posted @ 2015-07-15 21:12 曾可爱 阅读(130) 评论(0) 推荐(0)
摘要:Problem Definition: Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space?思路:为了达到O(1)... 阅读全文
posted @ 2015-07-15 19:30 曾可爱 阅读(114) 评论(0) 推荐(0)
摘要:Problem Definition: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definiti... 阅读全文
posted @ 2015-07-15 16:28 曾可爱 阅读(149) 评论(0) 推荐(0)
摘要:Problem Definition: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked... 阅读全文
posted @ 2015-07-15 16:10 曾可爱 阅读(144) 评论(0) 推荐(0)