摘要: Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could 阅读全文
posted @ 2017-10-16 20:02 daniel456 阅读(629) 评论(0) 推荐(0) 编辑
摘要: Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we tak 阅读全文
posted @ 2017-10-16 19:40 daniel456 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = 阅读全文
posted @ 2017-10-16 19:26 daniel456 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2017-10-16 19:21 daniel456 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Design a data structure that supports all following operations in average O(1) time. 设计一个数据结构,使得插入、删除,随机获取一个元素的时间复杂度都是O(1) 阅读全文
posted @ 2017-10-16 17:41 daniel456 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2017-10-16 16:55 daniel456 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文
posted @ 2017-10-16 16:41 daniel456 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 阅读全文
posted @ 2017-10-16 16:26 daniel456 阅读(98) 评论(0) 推荐(0) 编辑
摘要: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
posted @ 2017-10-16 16:13 daniel456 阅读(78) 评论(0) 推荐(0) 编辑
摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find 阅读全文
posted @ 2017-10-16 16:10 daniel456 阅读(101) 评论(0) 推荐(0) 编辑