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 阅读全文
posted @ 2016-12-31 08:09 Grandyang 阅读(1523) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-30 22:07 Grandyang 阅读(9873) 评论(6) 推荐(1) 编辑
摘要:Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Input: "tree" Output: "eert" Explanation: 'e' appears twi 阅读全文
posted @ 2016-12-29 03:56 Grandyang 阅读(9753) 评论(4) 推荐(1) 编辑
摘要: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 阅读全文
posted @ 2016-12-28 09:33 Grandyang 阅读(17137) 评论(9) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-27 06:12 Grandyang 阅读(12297) 评论(13) 推荐(0) 编辑
摘要: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] 阅读全文
posted @ 2016-12-26 14:16 Grandyang 阅读(18490) 评论(3) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-23 23:55 Grandyang 阅读(22212) 评论(0) 推荐(1) 编辑
摘要: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 @ 2016-12-22 05:36 Grandyang 阅读(14610) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-21 16:08 Grandyang 阅读(10278) 评论(2) 推荐(1) 编辑
摘要: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 阅读全文
posted @ 2016-12-20 01:05 Grandyang 阅读(22462) 评论(8) 推荐(1) 编辑
摘要: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 阅读全文
posted @ 2016-12-19 23:30 Grandyang 阅读(888) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-18 14:12 Grandyang 阅读(13445) 评论(15) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-17 05:21 Grandyang 阅读(672) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-16 23:53 Grandyang 阅读(13586) 评论(3) 推荐(1) 编辑
摘要: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 阅读全文
posted @ 2016-12-15 23:53 Grandyang 阅读(10660) 评论(0) 推荐(1) 编辑
摘要: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 阅读全文
posted @ 2016-12-14 23:45 Grandyang 阅读(12627) 评论(8) 推荐(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 @ 2016-12-12 23:03 Grandyang 阅读(959) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-09 14:06 Grandyang 阅读(7911) 评论(5) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-08 22:29 Grandyang 阅读(8485) 评论(3) 推荐(0) 编辑
摘要:Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyza 阅读全文
posted @ 2016-12-07 22:25 Grandyang 阅读(7572) 评论(3) 推荐(1) 编辑
摘要: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 阅读全文
posted @ 2016-12-06 14:07 Grandyang 阅读(5345) 评论(3) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-05 10:30 Grandyang 阅读(771) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-04 23:28 Grandyang 阅读(510) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-03 23:37 Grandyang 阅读(701) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-02 23:40 Grandyang 阅读(2308) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2016-12-01 13:52 Grandyang 阅读(185) 评论(0) 推荐(0) 编辑

Fork me on GitHub