GithubHelp home page GithubHelp logo

kamyu104 / facebookhackercup-2020 Goto Github PK

View Code? Open in Web Editor NEW
24.0 6.0 9.0 110 KB

๐Ÿƒ Python Solutions of All 24 Problems in FHC 2020

Python 100.00%
algorithm algorithm-challenges programming-contests hackercup puzzle-solution facebook-hacker-cup contest-programming competitive-programming

facebookhackercup-2020's Introduction

Python solutions of Facebook Hacker Cup 2020. Solution begins with * means it will get TLE in the largest data set (total computation amount > 10^8, which is not friendly for Python to solve in 5 ~ 15 seconds). A 6-minute timer is set for uploading the result this year.

Qualification Round

# Title Solution Time Space Difficulty Tag Note
A Travel Restrictions Python O(N^2) O(1) Easy Two Pointers
B Alchemy Python O(N) O(1) Easy Math
C Timber Python O(NlogN) O(N) Medium DP
D1 Running on Fumes - Chapter 1 Python O(N) O(M) Medium Mono Deque
D2 Running on Fumes - Chapter 2 Python O(NlogN) O(N) Hard DFS, BFS, Segment Tree

Round 1

# Title Solution Time Space Difficulty Tag Note
A1 Perimetric - Chapter 1 Python O(N) O(N) Easy Mono Deque
A2 Perimetric - Chapter 2 Python O(NlogN) O(N) Medium Skip List, Line Sweep
A3 Perimetric - Chapter 3 PyPy O(NlogN) O(N) Hard Skip List, Line Sweep
B Dislodging Logs Python O(NlogN + MlogM + (M + N) * log(max(max(Q)-min(P), max(P)-min(Q)))) O(N + M) Easy Binary Search, Greedy
C Quarantine Python O(N) O(N) Hard Preorder Traversal, Flood Fill, DP

Round 2

# Title Solution Time Space Difficulty Tag Note
A Ca-pasta-ty Python O(N) O(1) Easy Math
B Elimination Python O(N^2) O(N^2) Medium Math, DP
C Circular Circles PyPy O((N * M + E) * (logN + logM)) O(N) Medium Skip List
D Log Drivin' Hirin' Python O(N * (logN)^2 + MlogN) O(N) Hard Skip List, Dynamic Convex Hull Trick

Round 3

# Title Solution Time Space Difficulty Tag Note
A Chain Explosions Python O(K^(1/2)) O(1) Easy Math
B Railroad Renovations Python O(N^3) O(N * K) Medium DP, Math
C Mail Security PyPy O((N + M) * (logN + logM)^2) O(N + M) Hard Binary Search, Skip List, Greedy
D Smart Carts PyPy O(N^3) O(N) Hard Math, Precompute

Final Round

You can relive the magic of the 2020 Hacker Cup World Finals by watching the Live Stream Recording of the announcement of winners.

# Title Solution Time Space Difficulty Tag Note
A Cryptoconference Python O(NlogN) O(N) Easy Skip List, Counting
B Somebody Else's Problem Python O(N) O(H) Easy Tree Traversal, DP
C Pond Precipitation Python O(N^5) O(N^2) Medium DP, Euler's Theorem, Expected Value
D Spider Spring *PyPy PyPy PyPy O((N + M) * logN) O(N) Medium Skip List, Segment Tree, BIT, Fenwick Tree, Counting
E Tree Training PyPy O(N * (logN)^2) O(N) Hard Binary Search, Counting
F Cake-Cutting Committee PyPy O(N^2 * logN) O(N) Hard Geometry, Line Sweep, Segment Tree

facebookhackercup-2020's People

Contributors

kamyu104 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.