Leave your Email to get the latest Facebook interview questions weekly. No spam we promise.
Given an array of numbers, remove the increasing sequences until there is no change.
Print elements in 2d array diagonally.
The expected output is ...
Based on an array char[] order which defines a custom order of characters, find if the list of strings is sorted increasingly by the custom order.
Given an array of numbers [1, 2, 3, 1, 4, 2, ..... ]. (Notice there could be duplicate) Also given an integer N, which means two same numbers must be N space away.
You are going to write a program to find out a way to padding zeros to these numbers with the minimum total length...
Facebook Phone Interview Questions 2019
Sort Strings Based on Custom Alphabet Order
Decode String
Find Leftmost 0 in Sorted 2D Array
Get Product of Array Except Self
Find Sum of Columns in Binary Tree | Binary Tree Vertical Order Traversal Sum
Build String with Words in Dictionary
...
Given many coins of 3 different face values, print the combination sums of the coins up to 1000. Must be printed in order.
eg: coins(10, 15, 55)
print:
10
15
20
25
30
.
.
.
1000
# There's a room with a TV and people are coming in and out to watch it. The TV is on only when there's at least a person in the room.
# For each person that comes in, we record the start and end time. We want to know for how long the TV has been on. In other words:
# Given a list of arrays of time intervals, write a function that calculates the total amount of time covered by the intervals.
# For example:
# input = [(1,4), (2,3)]
# > 3
# input = [(4,6), (1,2)]
# > 3
# input = {{1,4}, {6,8}, {2,4}, {7,9}, {10, 15}}
# > 11
Given many coins of 3 different face values, print the combination sums of the coins up to 1000. Must be printed in order.
Implement a ring buffer
Give a binary tree, find if it's possible to cut the tree into two halves of equal sum. You can only cut one edge.
Given a Binary Search Tree (BST) with root node root, and a target value V, split the tree into two subtrees where one subtree has nodes that are all smaller or equal to the target value, while the other subtree has all nodes that are greater than the target value. It's not necessarily the case that the tree contains a node with value V.
Find whether string S is periodic. Periodic indicates S = nP. e.g. S = "ababab", then n = 3, and P = "ab" S = "xxxxxx", then n = 1, and P = "x" S = "aabbaaabba", then n = 2, and P = "aabba" follow up: Given string S, find out the P (repetitive pattern) of S.
In the following, every capital letter represents some hexadecimal digit from 0 to f.
The red-green-blue color "#AABBCC" can be written as "#ABC" in shorthand. For example, "#15c" is shorthand for the color "#1155cc".
Now, say the similarity between two colors "#ABCDEF" and "#UVWXYZ" is -(AB - UV)^2 - (CD - WX)^2 - (EF - YZ)^2.
Given the color "#ABCDEF", return a 7 character color that is most similar to #ABCDEF, and has a shorthand (that is, it can be represented as some "#XYZ"
We are given an array A of positive integers, and two positive integers L and R (L <= R). Return the number of (contiguous, non-empty) subarrays such that the value of the maximum array element in that subarray is at least L and at most R.
In the array {1, 6, 3, 5, 9, 7}, the longest arithmetic sequence is 1, 3, 5, and 7
Facebook On-site 1st Round: Behavioral + longest consecutive sequence. Can be solved with map in O(n) time.
Facebook Senior Engineer On-site There was no phone interview. Got to the onsite directly. It’s the second time interviewing at Facebook. Last year I got the feedback ‘Good coding though will hope for better design skills’. The position is senior level so no offer. A year later they came to me...
LeetCode Easy
38 Count and Say
209 Minimum Size Subarray Sum
80 Remove Duplicates from Sorted Array II
252 Meeting Rooms
78 Subsets
67 Add Binary
261 Graph Valid Tree
275 H-Index II
278 First Bad Version
211 Add and Search Word - Data structure design
Excel Sheet Column Title
Binary Search Tree Iterator
200 Number of Islands
125 Valid Palindrome
283 Move Zeroes
117 Populating Next Right Pointers in Each Node II
274 H-Index
79 Word Search
Increasing Triplet Subsequence
49 Group Anagrams
Walls and Gates
50 Pow(x, n)
311 Sparse Matrix Multiplication
98 Validate Binary Search Tree
Read N Characters Given Read4
277 Find the Celebrity
71 Simplify Path
90 Subsets II
325 Maximum Size Subarray Sum Equals k
Binary Tree Level Order Traversal
69 Sqrt(x)
221 Maximal Square
257 Binary Tree Paths
236 Lowest Common Ancestor of a Binary Tree
121 Best Time to Buy and Sell Stock
234 Palindrome Linked List
Remove Duplicates from Sorted Array
88 Merge Sorted Array
238 Product of Array Except Self
33 Search in Rotated Sorted Array
208 Implement Trie (Prefix Tree)
43 Multiply Strings
235 Lowest Common Ancestor of a Binary Search Tree
314 Binary Tree Vertical Order Traversal
161 One Edit Distance
Decode Ways
Valid Parentheses
13 Roman to Integer
127 Word Ladder
Merge Intervals
75 Sort Colors
28 Implement strStr()
285 Inorder Successor in BST
215 Kth Largest Element in an Array
133 Clone Graph
Word Break
206 Reverse Linked List
15 3Sum
Letter Combinations of a Phone Number
1 Two Sum
210 Course Schedule II
341 Flatten Nested List Iterator
377 Combination Sum IV
398 Random Pick Index
404 Sum of Left Leaves
Meeting Rooms II
Insert Delete GetRandom O(1)
477 Total Hamming Distance
461 Hamming Distance
494 Target Sum
525 Contiguous Array
523 Continuous Subarray Sum
535 Encode and Decode TinyURL
543 Diameter of Binary Tree
554 Brick Wall
572 Subtree of Another Tree
578 Get Highest Answer Rate Question
602 Friend Requests II: Who Has the Most Friends
597 Friend Requests I: Overall Acceptance Rate
621 Task Scheduler
637 Average of Levels in Binary Tree
Exclusive Time of Functions
653 Two Sum IV - Input is a BST
670 Maximum Swap
674 Longest Continuous Increasing Subsequence
673 Number of Longest Increasing Subsequence
680 Valid Palindrome II
647 Palindromic Substrings
Best Time to Buy and Sell Stock with Transaction Fee
721 Accounts Merge
Number Of Corner Rectangles
764 Largest Plus Sign
785 Is Graph Bipartite?
784 Letter Case Permutation
268 Missing Number
801 Minimum Swaps To Make Sequences Increasing
824 Goat Latin
825 Friends Of Appropriate Ages
394 Decode String
LeetCode Hard
265 Paint House II
Remove Invalid Parentheses
25 Reverse Nodes in k-Group
Merge k Sorted Lists
158 Read N Characters Given Read4 II - Call multiple times
85 Maximal Rectangle
57 Insert Interval
128 Longest Consecutive Sequence
273 Integer to English Words
297 Serialize and Deserialize Binary Tree
10 Regular Expression Matching
218 The Skyline Problem
269 Alien Dictionary
146 LRU Cache
Expression Add Operators
68 Text Justification
Split Array Largest Sum
Wildcard Matching
76 Minimum Window Substring
639 Decode Ways II
Design Search Autocomplete System
689 Maximum Sum of 3 Non-Overlapping Subarrays
745 Prefix and Suffix Search