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

随笔分类 -  面经

上一页 1 2 3 4 下一页
FB面经 Prepare: Even Tree

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

摘要:Spread from center: Like LC 5: longest palindromic substring 阅读全文
posted @ 2017-01-16 13:55 neverlandly 阅读(507) 评论(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 阅读(424) 评论(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 阅读(1318) 评论(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 阅读(328) 评论(0) 推荐(0)
Leetcode: Encode String with Shortest Length && G面经

摘要:DP: Initially I think of 1D DP, dp[i] stands for the shortest string of first i characters, then: dp[i] = minLen{dp[k] + encode(substring(k+1, i))} th 阅读全文
posted @ 2016-12-23 06:25 neverlandly 阅读(2168) 评论(0) 推荐(0)
Bloomberg面经准备: Josephus problem

摘要:Solution 1: Math Let f(n,k) denote the position of the survivor. After the kth person is killed, we're left with a circle of n-1, and we start the nex 阅读全文
posted @ 2016-12-17 01:53 neverlandly 阅读(1270) 评论(0) 推荐(0)
G 面经 && Leetcode: Longest Repeating Character Replacement

摘要:真是被这道题气死了,总是弄不对 The problem says that we can make at most k changes to the string (any character can be replaced with any other character). So, let's 阅读全文
posted @ 2016-12-05 13:58 neverlandly 阅读(437) 评论(0) 推荐(0)
Snapchat面经(师兄的)

摘要:我的想法:假设给定的点事ListNode oneNode, 设置ListNode dummy = new ListNode(-1); dummy.next = oneNode 然后扫描一次找到环里最后一个点,断链:ListNode end.next = null; 然后就开始扫描,删点 然后再扫描一 阅读全文
posted @ 2016-10-19 00:49 neverlandly 阅读(543) 评论(0) 推荐(0)
M面经prepare: Shuffle a deck

摘要:设计一个shuffle card 用了java. Random Class 1 package Random; 2 import java.util.*; 3 4 public class Solution { 5 static int cardNum = 10; 6 public int[] sh 阅读全文
posted @ 2016-02-17 04:50 neverlandly 阅读(611) 评论(0) 推荐(0)
M面经Prepare: Find integer Average of 2 integers.

摘要:The definition of integer average is the highest smaller integer if average is floating point number. Also the condition if that they can not use any 阅读全文
posted @ 2016-02-16 11:56 neverlandly 阅读(397) 评论(0) 推荐(0)
M面经Prepare: Positive-Negative partitioning preserving order

摘要:Given an array which has n integers,it has both positive and negative integers.Now you need sort this array in a special way.After that,the negative i 阅读全文
posted @ 2016-02-16 07:40 neverlandly 阅读(382) 评论(0) 推荐(0)
M面经Prepare: Delete Words Starting With One Character

摘要:给定一个char array, 这个array是一个句子,然后给定一个字母,把这个array里面带有这个字母开头的单次删掉,操作是要求in place. 检测 array[i]==' ' && i<array.length-1 && array[i+1]==target,这种情况,设置j从i+1开始 阅读全文
posted @ 2016-02-16 04:15 neverlandly 阅读(322) 评论(0) 推荐(0)
Groupon面经:Find paths in a binary tree summing to a target value

摘要:You are given a binary tree (not necessarily BST) in which each node contains a value. Design an algorithm to print all paths which sum up to that val 阅读全文
posted @ 2016-02-04 12:02 neverlandly 阅读(617) 评论(0) 推荐(0)
Groupon面经Prepare: Max Cycle Length

摘要:题目是遇到偶数/2,遇到奇数 *3 + 1的题目,然后找一个range内所有数字的max cycle length。对于一个数字,比如说44,按照题目的公式不停计算,过程是 44, 22, 11, 8, 9 ,1(瞎起的),从44到1的这个sequence的长度,叫做cycle length。然后题 阅读全文
posted @ 2016-02-04 05:21 neverlandly 阅读(595) 评论(0) 推荐(0)
Groupon面经Prepare: Sort given a range && Summary: Bucket Sort

摘要:首先是如何sort一个只有0和1的数组,要求inplace. follow up是告诉一个range,如何在O(N)时间内sort好 两个pointer可解 1 package Sorting; 2 import java.util.*; 3 4 public class InplaceSortin 阅读全文
posted @ 2016-02-04 01:27 neverlandly 阅读(370) 评论(0) 推荐(0)
G面经prepare: Maximum Subsequence in Another String's Order

摘要:求string str1中含有string str2 order的 subsequence 的最小长度DP做法:dp[i][j]定义为pattern对应到i位置,string对应到j位置时,shortest substring的长度,Int_Max表示不存在 1 package ShortestSu... 阅读全文
posted @ 2016-01-20 23:38 neverlandly 阅读(352) 评论(0) 推荐(0)
G面经prepare: Set Intersection && Set Difference

摘要:求两个sorted数组的intersection e.g. [1,2,3,4,5],[2,4,6] 结果是[2,4]difference类似merge, 分小于等于大于三种情况,然后时间O(m+n), 空间O(1) 1 package ShortestSubsequenceIncluding; 2... 阅读全文
posted @ 2016-01-20 11:52 neverlandly 阅读(307) 评论(0) 推荐(0)
G面经prepare: Pattern Match

摘要:设定一个pattern 把 'internationalization' 变成 'i18n', 比如word是house,pattern可以是h3e, 3se, 5, 1o1s1等,给pattern和word,判断是否match, 1 package DataStreamAverage; 2 3 ... 阅读全文
posted @ 2016-01-20 07:06 neverlandly 阅读(341) 评论(0) 推荐(0)
G面经prepare: Data Stream Average

摘要:给一个datastream和一个fixed window size, 让我design一个class可以完成add number还有find average in the window. 就是不能用vector得用array. 当然用queue是最好的package DataStreamAverag... 阅读全文
posted @ 2016-01-20 01:12 neverlandly 阅读(365) 评论(0) 推荐(0)

上一页 1 2 3 4 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3