IncredibleThings

导航

2015年4月27日 #

LeetCode-String to Integer (atoi)

摘要: Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below a... 阅读全文

posted @ 2015-04-27 07:45 IncredibleThings 阅读(136) 评论(0) 推荐(0) 编辑

2015年4月26日 #

LeetCode-Reverse Integer

摘要: Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are s... 阅读全文

posted @ 2015-04-26 03:03 IncredibleThings 阅读(104) 评论(0) 推荐(0) 编辑

2015年4月22日 #

LeetCode-Longest Substring Without Repeating Characters

摘要: 这道题考察如何维护一个window。 另一种可以通过OA 的方法: 利用hashmap存储不重复子串,key为字符,value为此字符的位置。从前向后进行遍历,只要map 中没有当前字符,便将其加入map 。并将子串长度加一。若当前字符已经出现在map 中,获得map中 此字符的位置,清除此位置以及 阅读全文

posted @ 2015-04-22 02:31 IncredibleThings 阅读(126) 评论(0) 推荐(0) 编辑

2015年4月17日 #

LeetCode-Add Two Numbers

摘要: 这道题在原理上很简单,模拟了加法的运算。但如何使code写的简洁是个难点,另外运用到了前置节点和遍历节点的技术。 二刷: 阅读全文

posted @ 2015-04-17 04:37 IncredibleThings 阅读(150) 评论(0) 推荐(0) 编辑

2015年4月16日 #

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 nu... 阅读全文

posted @ 2015-04-16 05:05 IncredibleThings 阅读(127) 评论(0) 推荐(0) 编辑

2015年3月18日 #

LeetCode-Linked List Cycle II

摘要: 这道题其实是一个数学题,先检测出是不是有环,在有环的情况下slow再走x步(x是环外的节点个数)就可以到达环的开始点。 阅读全文

posted @ 2015-03-18 22:34 IncredibleThings 阅读(134) 评论(0) 推荐(0) 编辑

LeetCode-Linked List Cycle

摘要: runner 问题,注意while循环条件; 阅读全文

posted @ 2015-03-18 06:15 IncredibleThings 阅读(133) 评论(0) 推荐(0) 编辑

LeetCode-Reorder List

摘要: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For e... 阅读全文

posted @ 2015-03-18 03:07 IncredibleThings 阅读(119) 评论(0) 推荐(0) 编辑

2015年3月16日 #

LeetCode-Binary Tree Postorder Traversal

摘要: 1 Given a binary tree, return the postorder traversal of its nodes' values. 2 3 For example: 4 Given binary tree {1,#,2,3}, 5 1 6 \ 7 2 ... 阅读全文

posted @ 2015-03-16 10:53 IncredibleThings 阅读(133) 评论(0) 推荐(0) 编辑

2015年3月12日 #

LeetCode-Binary Tree Preorder Traversal

摘要: Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3]... 阅读全文

posted @ 2015-03-12 11:46 IncredibleThings 阅读(144) 评论(0) 推荐(0) 编辑