• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
03 2017 档案
FB面经Prepare: Email User

摘要:账号之间如果有公共email就连边,我觉得要用hashMap, 存(email, user) pair 如果当前user的某个email在hashMap里出现过,当时是user1, 就看user和user1是否connected,否的话就要union,根据Union Find Union Find 阅读全文
posted @ 2017-03-18 02:30 neverlandly 阅读(852) 评论(1) 推荐(0)
Lintcode: Nuts & Bolts Problem

摘要:Quick Sort Way: We can use quick sort technique to solve this. We represent nuts and bolts in character array for understanding the logic. Nuts repres 阅读全文
posted @ 2017-03-17 06:12 neverlandly 阅读(747) 评论(0) 推荐(0)
FB面经Prepare: Merge K sorted Array

摘要:跟Merge K sorted lists不同在于,从PQ里poll出来以后不知道下一个需要被加入PQ的是哪一个 所以需要写一个wrapper class 阅读全文
posted @ 2017-03-17 04:45 neverlandly 阅读(689) 评论(0) 推荐(0)
FB面经 Prepare: Count Unique Island

摘要:方法可以是记录每次新的岛屿搜索的路径,left,right,up,down, 作为标志是否相同的key,存hashset 阅读全文
posted @ 2017-03-17 02:46 neverlandly 阅读(645) 评论(0) 推荐(0)
FB面经 Prepare: Make Parentheses valid

摘要:从左从右各scan一次 阅读全文
posted @ 2017-03-16 22:59 neverlandly 阅读(564) 评论(0) 推荐(0)
FB面经Prepare: Bipartite a graph

摘要:这道题应该是how to bipartite a graph Taken from GeeksforGeeks Following is a simple algorithm to find out whether a given graph is Birpartite or not using B 阅读全文
posted @ 2017-03-15 06:51 neverlandly 阅读(758) 评论(0) 推荐(0)
FB面经 Prepare: LCA of Deepest Nodes in Binary Tree

摘要:Recursion: 返回的时候返回lca和depth,每个node如果有大于一个子节点的depth相同就返回这个node,如果有一个子节点depth更深就返回个子节点lca,这个o(n)就可以了 Iteration: tree的recursion换成iteration处理,一般用stack都能解决 阅读全文
posted @ 2017-03-15 00:38 neverlandly 阅读(1579) 评论(0) 推荐(0)
FB面经 Prepare: K closest point to the origin

摘要:Based on bucket sort: Based on Quick Select 当然,还有的方法是维护一个size为k的最大堆 阅读全文
posted @ 2017-03-14 09:58 neverlandly 阅读(2115) 评论(0) 推荐(0)
FB面经prepare: 3 Window Max Sum

摘要:Follow Up: 这个其实可以优化到O(n)时间。建从左端到每个下标的最大window数组,再建从右端到每个下标的最大window数组。再从左往右走一遍所有的size k window,将其和与上一步建的两个数组一起加起来。遍历一遍取最大值即可。 阅读全文
posted @ 2017-03-14 05:39 neverlandly 阅读(635) 评论(0) 推荐(0)
Lintcode: Knight Shortest Path

摘要:BFS solution: 阅读全文
posted @ 2017-03-14 03:31 neverlandly 阅读(1441) 评论(0) 推荐(0)
Leetcode: Encode and Decode TinyURL

摘要:1. 根据系统设计的Estimation of the amount of data we need to store for the next couple of years, 我们应需要6位Base62的char来encode 2. assume 避免地址爆炸,相同的longUrl得到相同的sh 阅读全文
posted @ 2017-03-11 04:30 neverlandly 阅读(4086) 评论(1) 推荐(0)

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3