IncredibleThings

导航

2016年6月1日 #

LeetCode-Delete Node in a Linked List

摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value ... 阅读全文

posted @ 2016-06-01 05:54 IncredibleThings 阅读(100) 评论(0) 推荐(0) 编辑

LeetCode-Lowest Common Ancestor of a Binary Search Tree

摘要: 思路,先判断入口是否有非法输入。 1 如果某一个root==p || root == q,那么LCA肯定是root(因为是top down,LCA肯定在root所囊括的树上,而root又是p q其中一个节点了,那么另外一个节点肯定在root之下,那么root就是LCA),那么返回root 2 如果r 阅读全文

posted @ 2016-06-01 05:53 IncredibleThings 阅读(121) 评论(0) 推荐(0) 编辑

2016年5月25日 #

LeetCode-Palindrome Linked List

摘要: 二刷, 注意findmid时候fast的起始点位和如何跳出while循环: 阅读全文

posted @ 2016-05-25 03:55 IncredibleThings 阅读(125) 评论(0) 推荐(0) 编辑

LeetCode-Implement Queue using Stacks

摘要: Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front of queue. peek() -- Get the front element. empt... 阅读全文

posted @ 2016-05-25 00:55 IncredibleThings 阅读(105) 评论(0) 推荐(0) 编辑

2016年5月24日 #

LeetCode-Invert Binary Tree

摘要: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 /** * Definition for a binary tree node. * public class TreeNode { * ... 阅读全文

posted @ 2016-05-24 23:21 IncredibleThings 阅读(141) 评论(0) 推荐(0) 编辑

2016年5月21日 #

LeetCode-Implement Stack using Queues

摘要: Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Get the top element. empty() -- Return wh... 阅读全文

posted @ 2016-05-21 06:21 IncredibleThings 阅读(139) 评论(0) 推荐(0) 编辑

2016年5月20日 #

LeetCode-Rectangle Area

摘要: 二刷: 先找到不响交的条件,在找橡胶的情况下如何求得各个点位 阅读全文

posted @ 2016-05-20 00:11 IncredibleThings 阅读(133) 评论(0) 推荐(0) 编辑

2016年5月19日 #

LeetCode-Contains Duplicate

摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element i... 阅读全文

posted @ 2016-05-19 23:06 IncredibleThings 阅读(214) 评论(0) 推荐(0) 编辑

LeetCode-Isomorphic Strings

摘要: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another... 阅读全文

posted @ 2016-05-19 22:38 IncredibleThings 阅读(117) 评论(0) 推荐(0) 编辑

2016年5月18日 #

LeetCode-Remove Linked List Elements

摘要: Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 --> 4 --> 5 /** * Definition for singly... 阅读全文

posted @ 2016-05-18 06:00 IncredibleThings 阅读(121) 评论(0) 推荐(0) 编辑