04 2016 档案

摘要:Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space 阅读全文
posted @ 2016-04-27 18:17 lilixu 阅读(118) 评论(0) 推荐(0) 编辑
摘要:Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so tha 阅读全文
posted @ 2016-04-27 15:49 lilixu 阅读(116) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文
posted @ 2016-04-27 14:50 lilixu 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For exa 阅读全文
posted @ 2016-04-14 15:23 lilixu 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL 阅读全文
posted @ 2016-04-14 15:03 lilixu 阅读(154) 评论(0) 推荐(0) 编辑
摘要:Sort a linked list using insertion sort. 以第一个元素head后面接null为起始数组,然后后面每个node插入排序,然而超时。 评论区的优化:双指针在原链表上插入排序,且只有在该node需要被插入开始处重置开始指针。 阅读全文
posted @ 2016-04-07 18:00 lilixu 阅读(131) 评论(0) 推荐(0) 编辑
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 阅读全文
posted @ 2016-04-07 11:35 lilixu 阅读(107) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文
posted @ 2016-04-06 17:11 lilixu 阅读(122) 评论(0) 推荐(0) 编辑