US Giants
文章平均质量分 89
喵喵旺
这个作者很懒,什么都没留下…
展开
-
[US Giants] 五. Greedy
Single Number Given 2*n + 1 numbers, every numbers occurs twice except one, find it. Example:Given [1,2,2,1,3,4,3], return 4 Challenge :One-pass, constant extra space. 思路:HashMap原创 2017-07-29 00:30:25 · 272 阅读 · 0 评论 -
[US Giants] 十. Data Structure
Longest Consecutive Sequence Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Clarification: Your algorithm should run in O(n) complexit原创 2017-09-26 23:23:34 · 286 阅读 · 0 评论 -
[US Giants] 八. Search & Recurison
Word Search Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizonta原创 2017-08-18 01:47:39 · 367 阅读 · 0 评论 -
[US Giants] 七. Binary Tree
Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees原创 2017-08-09 09:45:52 · 295 阅读 · 0 评论 -
[US Giants] 四.Math & Bit Manipulation
Trailing Zeros Write an algorithm which computes the number of trailing zeros in n factorial. Example 11! = 39916800, so the out should be 2 Challenge O(log N) time 思路原创 2017-07-27 10:05:49 · 351 阅读 · 0 评论 -
[US Giants] 三. Binary Search
Sqrt(x) :点击打开链接 Implement int sqrt(int x). Compute and return the square root of x. Example sqrt(3) = 1 sqrt(4) = 2 sqrt(5) = 2 sqrt(10) = 3 Challenge O(log(x)) cl原创 2017-07-26 09:54:47 · 246 阅读 · 0 评论 -
[US Giants] 一. String
Given two strings, find the longest common substring. Return the length of it. Notice The characters in substring should occur continuously in original string. This is different with subsequ原创 2017-07-20 06:18:47 · 557 阅读 · 0 评论 -
[US Giants] 六. Linked List
Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head. The minimum number of nodes in list is n. Example Gi原创 2017-07-31 10:54:04 · 251 阅读 · 0 评论 -
[US Giants] 二. Integer-Array
50. Product of Array Exclude Itself 点击打开链接 思路:两趟循环,对于每一个output[i]={i前面的数的乘积}*{i后面的数的乘积} 第一趟正向遍历数组,对于每个Xi计算Xo~Xi-1的连续乘积 第二趟反向遍历数组,对于每个Xi计算Xn-1~Xi+1的连续乘积 例如:A={2,3,4};原创 2017-07-23 09:59:56 · 308 阅读 · 0 评论