07 2017 档案
摘要:Given an unsorted array, find the largest pair sum. Solution 1. O(n*logn) runtime, using sorting Solution 2. O(n) runtime, using heapify (max priority
阅读全文
摘要:Given a string, reverse it without using any temporary variables. This problem is a variation of the problem swapping two integers without using any t
阅读全文
摘要: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.
阅读全文
摘要:Giving a string with number from 1 to n in random order, but miss 1 number.Find that number. You can assume n <= 30 Giving a string with number from 1
阅读全文
摘要:Given an array contains N numbers of 0 .. N, find which number doesn't exist in the array. Given an array contains N numbers of 0 .. N, find which num
阅读全文
摘要:Given an unsorted integer array, find the first missing positive integer. Given an unsorted integer array, find the first missing positive integer. Gi
阅读全文
摘要:Given an integer x, write a method that multiplies x with 3.5 and returns the integer result. You are not allowed to use %, /, or *. Examples: input 2
阅读全文
摘要:Given an array arr[0.....n-1] containing n positive integers, find the length of the longest bitonic subsequence. A subsequence of arr[] is called Bit
阅读全文
摘要:Given an unsorted array of integers, sort the array into a wave like array. An array arr[0...n-1] is sorted in wave form if arr[0] >= arr[1] <= arr[2]
阅读全文
摘要:Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Clarification What's the de
阅读全文
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Given an unsorted array of integers, find the lengt
阅读全文
摘要:Implement a load balancer for web servers. It provide the following functionality: Add a new server to the cluster => add(server_id). Remove a bad ser
阅读全文
摘要:Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges. Given a sorted integer
阅读全文
摘要: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 n
阅读全文
摘要:Given an integer array, find a subarray where the sum of numbers is in a given interval. Your code should return the number of possible answers. (The
阅读全文
摘要:Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.find
阅读全文
摘要:An abbreviation of a word follows the form . Below are some examples of word abbreviations: a) it --> it (no abbreviation) 1 b) d|o|g --> d1g 1 1 1 1
阅读全文
摘要:Given an interval list which are flying and landing time of the flight. How many airplanes are on the sky at most? If landing and flying happens at th
阅读全文
摘要:Given a non-overlapping interval list which is sorted by start point. Insert a new interval into it, make sure the list is still in order and non-over
阅读全文
摘要:The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it retu
阅读全文
摘要:Given a binary search tree and a new tree node, insert the node into the tree. You should keep the tree still be a valid binary search tree. You can a
阅读全文

浙公网安备 33010602011771号