简述各题 · Google Interview



简述各题 · Google Interview

4.Median of Two Sorted Arrays:二分法,注意细节,各种-1, + 1。

+

10.Regular Expression Matching: 注意为*时的三种表达,为多个字母,一个字母和空。

+

66.Plus One: 注意carry = 0的时候就可以结束了。

+

31.Next Permutation: 原理我始终没搞明白,但是好神奇,有空问问。reverse的时候要包括second。

+

274.H-Index: 注意j=len-i-1,注意条件是j>=citations[i]。注意各种细节。

+

360.Sort Transformed Array: two pointers,注意 a >=0 和a<0时输入到result的时候顺序得变,两个得数的判定情况也得变。

+

280.Wiggle Sort: 算法精妙,注意in-place。注意观察数的规律,奇数位需要比左边的偶数位的大,偶数位的要比左边奇数位的小。

+

281.Wiggle Sort II:

+

139.Word Break:

+

140.Word Break II:!!!

+

133.Clone Graph:

+

208.Implement Trie:

+

314.Binary Tree Vertical Order Traversal

+

146.LRU Cache:

+

460.LFU Cache:

+

312.Burst Balloons:

+

200.Number of Islands:

+

201.Number of IslandsII:

+

293.Flip Game:

+

294.Flip Game II:

+

375.Guess Number Higher or Lower:

+

376.Guess Number Higher or LowerII: !!!

+

224.Basic Calculator:

+

282.Expression Add Operators:

+

320.Generalized Abbreviation:注意怎样递归,没算复杂度

+

22.Generate Parentheses: !!!注意怎样递归,没算复杂度

+

239.Search a 2D Matrix II: 二分法 还没做

+

240.Search a 2D Matrix II: 从右上或左下角开始。

+

288.Unique Word Abbreviation: 注意各种情况,字典里本来就有重复,以及字典里只有一个相同的。

+

329.Longest Increasing Path in a Matrix: 用DP,要用一个数组记住已经算出节点的最大值。普通dfs会超时。

+

246.Strobogrammatic Number: 注意string的创建方法, 可用Arrays.asList("00", "11", "88","696") .

+

247.Strobogrammatic Number II:一层一层剥,可以重写一遍,注意0的加入。

+

20.Valid Parentheses: 注意stack是空的情况。

+

22.Generate Parentheses: 注意右括号要比左括号少才能加。

+

490.The Maze: 注意dfs的while里多加一次,要减掉。

+

505.The Maze II:visited变为distance,当值更小时更新。bfs可用PQ。

+

323.Number of Connected Components in an Undirected Graph

+

314.Binary Tree Vertical Order Traversal

+

394.Decode String: 俩stack,先放空的,push结果时要加上之前stack里的。

+

377.Combination Sum IV:仔细想想怎么做,公式!初始化!

+

316.Remove Duplicate Letters:注是subsequence,注意判断条件。

+

354.Russian Doll Envelopes:注意Arrays.binarySearch的用法。

+

474.Ones and Zeroes: DP,注意公式,注意一定要从后往前推。

+

503.Next Greater Element II:stack, 走两遍,第一遍倒着走第二遍顺着走。

+

501.Find Mode in Binary Search Tree: 注意list.clear()。

+

298.Binary Tree Longest Consecutive Sequence

+

494.Target Sum

+

485.Max Consecutive Ones

+

487.Max Consecutive Ones II

+

475.Heaters

+

498.Diagonal Traverse

+

486.Predict the Winner

+

310.Minimum Height Trees: 循环:n>2,注意iterator.next(),set不能转int。

+

239.Sliding Window Maximum: deque用法,先判断deque是否为空。

+

54.Spiral Matrix

+

56.Merge Intervals

+

23.Merge K sorted Lists

+

284.Peeking Iterator: 注意全局变量和next()方法的区别。

+

480.Sliding Window Median: 注意(double)加法和随时平衡两个堆。

+

361.Bomb Enemy:行不用数组因为可一直更新,注意算行列敌人时初始化。

+

341.Flatten Nested List Iterator: 用stack,注意while

+

281.Zigzag Iterator:注意iterator用法。

+

269.Alien Dictionary: 没写完太长,回忆topo sort,前一个数建图

+

380.Insert Delete GetRandom O(1)

+

228.Summary Ranges

+

370.Range Addition

+

295.Find Median from Data Stream:用Collections.reverseOrder或"-"

+

259.3Sum Smaller: res += right - left,中间一串数都是。

+

346.Moving Average from Data Stream

+

50.Pow(x, n)

+

286.Walls and Gates

+

351.Android Unlock Patterns

+

200.Number of Islands

+

305.Number of Islands II

+

271.Encode and Decode Strings

+

173.Binary Search Tree Iterator

+

57.Insert Interval

+

163.Missing Ranges

+

218.The Skyline Problem

+

42.Trapping Rain Water

+

407.Trapping Rain Water II:从外往里,新加点要和当前cell.height比较取大。

+


Read full article from 简述各题 · Google Interview


No comments:

Post a Comment

Labels

Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

Popular Posts