12 2016 档案
摘要:Given an array of integers, find a contiguous subarray which has the largest sum. Notice The subarray should contain at least one number. Have you met
阅读全文
摘要:Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one s
阅读全文
摘要:Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Input: "tree" Output: "eert" Explanation: 'e' appears twi
阅读全文
摘要:Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of th
阅读全文
摘要:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or
阅读全文
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n]
阅读全文
摘要:You are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain a single
阅读全文
摘要: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
阅读全文
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Now your job is to find the total
阅读全文
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul
阅读全文
摘要:Write an algorithm which computes the number of trailing zeros in n factorial. Have you met this question in a real interview? Yes Write an algorithm
阅读全文
摘要:Given a non-empty string, encode the string such that its encoded length is the shortest. The encoding rule is: k[encoded_string], where the encoded_s
阅读全文
摘要:Sometimes when you open a VS2010 project, an error window will pop up with the error message "Exceptions has been thrown by the target of an invocatio
阅读全文
摘要:In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a domin
阅读全文
摘要:In this problem, your job to write a function to check whether a input string is a valid IPv4 address or IPv6 address or neither. IPv4 addresses are c
阅读全文
摘要:Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are given p
阅读全文
摘要: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.
阅读全文
摘要:Define S = [s,n] as the string S which consists of n connected strings s. For example, ["abc", 3] ="abcabcabc". On the other hand, we define that stri
阅读全文
摘要:Given a list of points that form a polygon when joined sequentially, find if this polygon is convex (Convex polygon definition). Note: Example 1: Exam
阅读全文
摘要:Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyza
阅读全文
摘要:Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. Please note that the string
阅读全文
摘要:Given k strings, find the longest common prefix (LCP). Given k strings, find the longest common prefix (LCP). Have you met this question in a real int
阅读全文
摘要:Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operation. Have you met this question
阅读全文
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction
阅读全文
摘要:Sort a linked list in O(n log n) time using constant space complexity. Have you met this question in a real interview? Yes Sort a linked list in O(n l
阅读全文
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl
阅读全文