Coder Social home page Coder Social logo

coding-challenge's Introduction

Challenge 1

https://tranquil-temple-79124.herokuapp.com/messages/my_message

Heroku may take ~30 seconds to spin up the webserver when asleep

This webserver uses an in-process cache for the messages. This limits it to a single process which bottlenecks the throughput. To scale it larger, a dedicated cache like Redis should be used, as we could then add more workers that talk to Redis.

To Test:

URL='https://tranquil-temple-79124.herokuapp.com'
curl -X POST -H "Content-Type: application/json" -d '{"message": "foo"}' $URL/messages
curl $URL/messages/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
curl -i $URL/messages/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Challenge 2

My program runs in O(N) time and O(N) space. The first loops loads the prices into memory and looks for any exact matches. The second loop finds the closest match under our budget if we couldn't find an exact match.

To Test:

cd Challenge-2
python find-pair.py prices.txt 2500
python find-pair.py prices.txt 2300
python find-pair.py prices.txt 10000
python find-pair.py prices.txt 1100

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.