摘要: Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to 阅读全文
posted @ 2017-01-29 05:39 CodesKiller 阅读(267) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2017-01-29 04:23 CodesKiller 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2017-01-29 03:48 CodesKiller 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 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 - 阅读全文
posted @ 2017-01-28 10:05 CodesKiller 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 -- 阅读全文
posted @ 2017-01-28 09:58 CodesKiller 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文
posted @ 2017-01-28 09:45 CodesKiller 阅读(90) 评论(0) 推荐(0) 编辑
摘要: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you 阅读全文
posted @ 2017-01-28 09:38 CodesKiller 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2017-01-28 08:31 CodesKiller 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. 此题 阅读全文
posted @ 2017-01-28 08:19 CodesKiller 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2017-01-28 07:21 CodesKiller 阅读(162) 评论(0) 推荐(0) 编辑