# How to prepare for Facebook Hacker Cup?

Facebook hacker cup is an annual algorithmic programming contest organized by Facebook. Be it students, professionals or experts it attracts numerous programming enthusiasts from all around the globe. Top contenders are eligible for the interview call from Facebook for Software Developer role.

**What is the process?**

Facebook Hacker cup is particularly known for its different environment used for Judging and the variety of problems. It is conducted in many rounds where the difficulty of algorithmic challenges keep on increasing.

**What are the prizes?(May vary year to year)**

- 1st Place: $10,000 USD
- 2nd Place: $2,000 USD
- 3rd Place: $1,000 USD
- 4th-25th Place: $100 USD

Organized in the month of **January** Facebook Hacker cup is conducted in 4 series round:

**Qualification round:**Is the easiest round in which at least 1 problem needs to be solved successfully in order to advance in the next round. This round lasts for 72 hours.**Round 1 :**The selected candidates participate in round 1 which lasts for 24 hours and must gain at least certain number of points ( decided accordingly every year) to qualify for the round 2. This round is fairly difficult than the qualification round.**Round 2:**Candidates selected from the round 1 advance to participate in round 2 and compete in 3-hour format contest. Top 200 participants advance to Round 3 and top 500 participants are awarded with Hackercup T-shirt.**Round 3:**Top 200 participants compete in this 3-hour format contest and top 25 qualify for Onsite Final. From now on the problem set gets tough.**Onsite Final:**Top 25 participants from all over the globe compete for winning the title and trophy of Facebook hacker cup at its headquarters. Problems are quite challenging and are good enough to make the contestants sweat head to toe.

And the 1st person on the leader board bags the title and basks in glory.

**Format and Environment**

The judging format of Facebook hacker cup is quite different from other annual programming contests like ACM-ICPC or IOI.

- When the contest begins users are required to login in the website.
- After logging in they are presented with the problem set. After you think you have solved a problem and sure about its correctness, you have to
**download**an input test file. - As soon as the input test file is downloaded a timer of 6 minutes commences and in that window of time you are required to run the input test file over your code and form a test file. Within 6 minutes you need to submit both the code and the output text file.
- You can submitted more than once and only the last correct submission will be used for evaluation.
- Once the timer expires you will be unable to submit the solution for that problem again. Time penalty is the sum of submission times of a problem.

**How to prepare?**

Facebook Hacker cup is particularly famous for its innovative and mind tickling algorithmic challenges. Inclined more towards mathematics and combination of various concepts hacker cups tests knowledge, implementation, accuracy, speed, conceptuality and almost everything by its different rounds.

You need to be fast in order to survive further rounds and innovative to survive the initial long timed rounds.

These are the main topics which should be done thoroughly as problems are generally asked from more than 1 topics combined.

- Euclidian and extended Euclidian algorithm
- Modular Arithmetic and modular inverse
- Prime generation (Sieve and Segmented Sieve)
- Fermat`s theorem
- Euler Totient function
- Miller Rabin primality test
- Chinese remainder Theorem
- Lucas theorem.

- TopCoder-Binary Search
- Binary Search
- Ubiquitous Binary Search – Get grasp of discrete and continuous binary search.

- Linked lists
- Binary search tree
- Binary Indexed Tree or Fenwick tree
- Segment Tree (RMQ, Range Sum and Lazy Propagation)
- Red-Black trees
- Hashing

Extensive list of Data structures

**Graph Algorithms**

- Breadth First Search (BFS)
- Depth First Search (DFS)
- Shortest Path from source to all vertices **Dijkstra**
- Shortest Path from every vertex to every other vertex **Floyd Warshall**
- Minimum Spanning tree **Prim**
- Minimum Spanning tree **Kruskal**
- Topological Sort
- Johnson’s algorithm
- Articulation Points (or Cut Vertices) in a Graph
- Bridges in a graph

**String Algorithms**

Learning library functions for String actually proves very helpful (C++ : See this and this, String in Java).

- KMP algorithm
- Rabin karp
- Z’s algorithm
- Aho Corasick String Matching
- Suffix Arrays
- Trie
- Finite Automata

**Dynamic programming**

Dynamic programming is quite important and can be infused and asked with various other topics. Some different types of DP concepts are :

**Classic DP**

- Longest Common Subsequence
- Longest Increasing Subsequence
- Edit Distance
- Minimum Partition
- Ways to Cover a Distance
- Longest Path In Matrix
- Subset Sum Problem
- Optimal Strategy for a Game
- 0-1 Knapsack Problem
- Assembly Line Scheduling

**Computational geometry**

All in all Facebook Hacker cup is a very challenging contest and a person needs gigantic amount of training and perseverance and all the standard topics need to be etched and understood.

Practice is the only way to do so!

**Extra Points:**

- Practice on Codeforces (specially the GYM section) and TopCoder Arena. This will truly help in basic understanding.
- Facebook Hacker Cup’s problems have a different style than Codeforces and Topcoder, probably the best comparison would be with Google Code Jam who have a similar format.
- Go through previous Facebook – HackerCup questions and get familiar with the format of the contest.

This article is contributed by **Yash Kodesia in association with Team GeeksforGeeks**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

## Recommended Posts:

- How to prepare for ACM - ICPC?
- How to Prepare for HR Interviews
- How to prepare for AMCAT?
- How Should a Fresher Prepare for a Job Interview?
- What is Competitive Programming and How to Prepare for It?
- How to prepare for Google Kickstart - a CodeJam competition?
- How to Prepare for Amazon Software Development Engineering Interview?
- How to prepare for Google Asia Pacific University (APAC) Test ?
- Facebook Interview | Set 1
- Facebook Interview Questions
- Facebook Interview | Set 2 (On Campus for Internship)
- Facebook Interview | Security Analyst
- Facebook NYC Onsite Interview Experience
- [TopTalent.in] Exclusive Rapid Fire Interview with Deepali Who Got Into Facebook
- [TopTalent.in] Google, Facebook, Amazon, Walmart & PocketGems, All Fighting For Prasoon Mishra