As per Facebook’s official page, below are coding expections.
- This takes place in an online collaborative editor shared between you and the interviewer (or on the whiteboard if you do the initial interview in person).
- You are given one or more coding questions to complete in this editor. We ask questions that are short enough to explain in a few minutes and to solve in 10-30 minutes.
- In this section we try to understand your approach to problem solving.
- We typically don’t ask trick or estimation questions (we don’t care how many ping pong balls can be fit in Sea World).
- You could be asked to solve a problem in any way you choose, and then the interviewer could add further constraints or requirements.
Below are Tips from same Facebook’s official page
Tips for the Coding Interview:
- Think out loud: We pay a lot of attention to the way you solve problems, which can be as important as having the right answer. Thinking out loud gives the interviewer insight into your thinking process and can also help them follow along with your solution. Moreover, it allows them to give hints when needed.
- Locate a good interview spot: Choose a quiet place and ensure that you have good Internet connection and strong phone reception. Headphones will help with having your both hands free for coding.
- Speak clearly: Ensure you are speaking clearly and likewise, if you can’t hear the interviewer clearly, let them know so they can accommodate! You don’t want to waste the whole interview trying to understand each other.
- Use the programming language you’re best at: It’s important to write your solution correctly and in time, so use the language you are most familiar with.
- Manage Your Time Effectively: Spend some time figuring out the ideal solution to the question. Don’t jump too quickly into brute forcing the first solution that comes in mind. If you can’t find a better solution in a reasonable time, start writing a working solution, then iterate and improve it as you go. Some interviews end without any coding because the interviewee couldn’t find the ideal solution. It’s better to have non-optimal but working code than just an idea. Once you have a working solution, you can then try to improve its efficiency, code design or any other aspect of it.
- Share your reasoning: Make sure you can talk about your solution; you will probably be asked to explain them. Engineering is all about tradeoffs, so be prepared to discuss them.
- Find and fix the bugs by yourself: Don’t wait for the interviewer to find them for you.
- Use the hints you are given: Usually, the interviewer knows the question well enough to know which hints will help you next if you get stuck.
Important Resources :
- Recent Facebook Interview Experiences
- Facebook Practice Questions.
- How to prepare for Facebook Hacker Cup?
Below are some questions asked in Facebook Interviews.
- Converting Decimal Number lying between 1 to 3999 to Roman Numerals
- Find all triplets with zero sum
- Largest subset whose all elements are Fibonacci numbers
- Calculate maximum value using ‘+’ or ‘*’ sign between two numbers in a string
- Convert Ternary Expression to a Binary Tree
- Converting Roman Numerals to Decimal lying between 1 to 3999
- Count all distinct pairs with difference equal to k
- Decode a string recursively encoded as count followed by substring
- Find if string is K-Palindrome or not | Set 2
- Find Minimum Depth of a Binary Tree
- Find subarray with given sum | Set 1 (Nonnegative Numbers)
- Given two unsorted arrays, find all pairs whose sum is x
- Greedy Algorithms | Set 1 (Activity Selection Problem)
- Look-and-Say Sequence
- Smallest subarray with sum greater than a given value
- Program to add two binary strings
- Rearrange a string in sorted order followed by the integer sum
- Boggle | Set 2 (Using Trie)
- Count Possible Decodings of a given Digit Sequence
- Inplace rotate square matrix by 90 degrees | Set 1
- Largest Rectangular Area in a Histogram | Set 2
- Largest sum subarray with at-least k numbers
- Multiply Large Numbers represented as Strings