Giter Site home page Giter Site logo

outsideanalyticschallenge's Introduction

Outside Analytics Coding Challenge

My solution to the Outside Analytics Spring 2024 coding challenge.

Execution

The program is all contained in elevator.py and just depends on the Python stdlib. It was written for Python 3.10.4 but should work for any modern Python version.

Some simple test cases are contained in test_elevator.py.

# Run on single input
python elevator.py [starting floor] [floors to visit]

# Run test cases
python test_elevator.py

Output is in the format

[total travel time] [floors visited in order]

Details

Based on the given problem description, the starting floor and floors to visit inputs provide the floors to visit in the order to be visited; that is, they should not be reordered for more efficiency. So, the problem is simply to, given its path, calculate its travel time.

The list of floors to visit is treated like a queue, traveling to the floor at the front of the queue. We simply iterate over the queue, adding the cost of moving from the current floor to the next floor until all floors have been visited.

outsideanalyticschallenge's People

Watchers

 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.