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

摘要:O(N) solution: 两个interval overlap条件: interval1.end >= interval2.start && interval1.start <= interval2.end 问:一个query数在不在已经加入的区间? 如果interval是sorted, 就可以 阅读全文
posted @ 2017-01-31 07:34 neverlandly 阅读(605) 评论(0) 推荐(0)
Summary: Calculate average where sum exceed double limits

摘要:According to the highest vote in: http://stackoverflow.com/questions/1930454/what-is-a-good-solution-for-calculating-an-average-where-the-sum-of-all-v 阅读全文
posted @ 2017-01-31 01:38 neverlandly 阅读(283) 评论(0) 推荐(0)
Pocket Gem OA: Log Parser

摘要:涉及到处理Date, 以及STDIN from a file 处理Date可以用SimpleDateFormat这个class static Date parseTime(String timeStr) { Date time = new Date(); DateFormat dft = new S 阅读全文
posted @ 2017-01-28 12:25 neverlandly 阅读(815) 评论(0) 推荐(0)
Pocket Gem OA: Path Finder

摘要:题不难,主要是注意STDIN 阅读全文
posted @ 2017-01-28 12:19 neverlandly 阅读(1030) 评论(0) 推荐(0)
Leetcode: Sliding Window Median

摘要:方法1:Time Complexity O(NK) 暂时只有两个Heap的做法,缺点:In this problem, it is necessary to be able remove elements that are not necessarily at the top of the heap 阅读全文
posted @ 2017-01-24 05:24 neverlandly 阅读(747) 评论(0) 推荐(0)
Leetcode: Number Complement

摘要:Better solution: Returns an int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in the specified int va 阅读全文
posted @ 2017-01-23 23:54 neverlandly 阅读(332) 评论(0) 推荐(0)
FB面经 Prepare: Even Tree

摘要:我觉得题中应该再加上一个条件,就是guarantee是能够分割的,不然没法做. 如果总node总数是奇数的话, 怎么删都没法保证所有的子树是even number,所以这题的前提是node总数为偶数? 网上看到别人的很好的解法: 特别是用iterator.next()以后用iterator.remo 阅读全文
posted @ 2017-01-20 00:35 neverlandly 阅读(942) 评论(0) 推荐(0)
FB面经 Prepare: All Palindromic Substrings

摘要:Spread from center: Like LC 5: longest palindromic substring 阅读全文
posted @ 2017-01-16 13:55 neverlandly 阅读(511) 评论(0) 推荐(0)
FB面经 Prepare: Largest Island

摘要:Find largest island in a board 1 package fb; 2 3 public class LargestIsland { 4 public int findLargestIsland(int[][] board) { 5 if (board==null || board.length==0 || board[0].le... 阅读全文
posted @ 2017-01-16 11:03 neverlandly 阅读(429) 评论(0) 推荐(0)
FB面经 Prepare: Task Schedule

摘要:tasks has cooldown time, give an input task id array, output finish time input: AABCA A--ABCA output:7 1 package fb; 2 3 import java.util.*; 4 5 public class Scheduler { 6 7 pub... 阅读全文
posted @ 2017-01-16 01:07 neverlandly 阅读(1321) 评论(0) 推荐(0)
Leetcode Articles: Insert into a Cyclic Sorted List

摘要:Solution:Basically, you would have a loop that traverse the cyclic sorted list and find the point where you insert the value (Let’s assume the value b 阅读全文
posted @ 2017-01-11 00:40 neverlandly 阅读(1635) 评论(0) 推荐(0)
Summary: How to calculate PI? Based on Monte Carlo method

摘要:refer to: http://www.stealthcopter.com/blog/2009/09/python-calculating-pi-using-random-numbers/ During my undergraduate degree I wrote a program in fo 阅读全文
posted @ 2017-01-09 13:34 neverlandly 阅读(683) 评论(0) 推荐(0)
U家面试prepare: Serialize and Deserialize Tree With Uncertain Children Nodes

摘要:The method to serialize is like this: (1(2)(3(5)(6))(4(7))) if '(', right shift 1 position to the start of the number, use while loop to find the end 阅读全文
posted @ 2017-01-07 12:43 neverlandly 阅读(330) 评论(0) 推荐(0)

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