上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 50 下一页
摘要: Given a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left boundary, leaves, and ri 阅读全文
posted @ 2018-09-04 12:40 轻风舞动 阅读(1386) 评论(0) 推荐(1) 编辑
摘要: Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 2: Example 3: Note: Your algorithm should run in O(n) 阅读全文
posted @ 2018-09-04 08:06 轻风舞动 阅读(242) 评论(0) 推荐(0) 编辑
摘要: A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls. The world is modeled as a 2-D array of cells, wher 阅读全文
posted @ 2018-09-04 07:03 轻风舞动 阅读(633) 评论(0) 推荐(0) 编辑
摘要: We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, 阅读全文
posted @ 2018-09-03 08:16 轻风舞动 阅读(893) 评论(0) 推荐(0) 编辑
摘要: We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i]. Note that both elements are in the s 阅读全文
posted @ 2018-09-03 06:14 轻风舞动 阅读(668) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get. 阅读全文
posted @ 2018-09-03 05:34 轻风舞动 阅读(1049) 评论(0) 推荐(0) 编辑
摘要: 假设数组是从小到大排序,数值可能为负数、0、正数。 思路一 可以一次性遍历一遍,找出绝对值最小值,此时时间复杂度为O(N),缺点是没有利用数组是有序的这一特点。 思路二 数组有序,可以利用二分查找的特性。中间的数是正数,往后找;中间的数是负数,往前找。 问题的本质是找到正数的最小值,或负数的最大值, 阅读全文
posted @ 2018-09-03 04:25 轻风舞动 阅读(516) 评论(0) 推荐(0) 编辑
摘要: Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Example 2: Note: 0 < s1.length, s2.len 阅读全文
posted @ 2018-09-02 16:30 轻风舞动 阅读(454) 评论(0) 推荐(0) 编辑
摘要: Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one cha 阅读全文
posted @ 2018-09-02 16:16 轻风舞动 阅读(513) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity. Example 1: Example 2: 给一个链表排序,要求Time: O(nlogn), constant space complexity. 解法:1 阅读全文
posted @ 2018-09-02 04:34 轻风舞动 阅读(207) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 50 下一页