Coder Social home page Coder Social logo

hc20's Introduction

Google Hash Code 2020

This is a Google Hash Code 2020 solution (Rank 824 out of 10724): Problem statement.

Build & Run

git clone https://github.com/baurst/hc20
cd hc20
cargo run --release 0 1 2 3 4 5

Each digit represents a specific problem (check folder datasets):

  1. a_example.txt
  2. b_read_on.txt
  3. c_incuabula.txt
  4. d_tough_choices.txt
  5. e_so_many_books.txt
  6. f_libraries_of_the_world.txt

If you provide multiple digits, the problems will be solved in parallel. The tool will create a directory called out and save the solutions with their respective score.

Background

Our original solution was done in Python. Python is great when you need to get things done quickly and don't want to be bothered about types. Plus, as long as you can express your problem in terms of matrices and matrix-operations (numpy), it's very fast. I reimplemented our solution to get a feeling about whether I could have done the competition in Rust, which offers a nicer development experience in my opinion. Rust has a steeper learning curve, but it is fast out of the box: Instead of having to focus on a solution that can be expressed using numpy matrix operations I can come up with any idea, implement it in the most intuitive way and the compiler will take care of the speed, which is liberating.

Takeaways for doing Coding Competitions with Rust

  • with good preparation (stubs for data loading and writing...) coding competitions can absolutely be done in Rust
  • unsurprisingly, coding in Python is still faster
  • with Rust there is much less time spent debugging: at least for me, if the code compiles it's correct most of the time
  • don't worry about optimizations, the compiler will take care of speed: focus on your actual solution

Team Members for the original solution

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.