Coder Social home page Coder Social logo

climbing_stairs's Introduction

Climbing stairs

The Problem

A stairwell has a number of flights of stairs separated by landings. Each flight is a straight line of steps that you can climb without stopping. You can stride more than one step at a time when climbing each flight. It takes two strides to turn on the landing and start again on next flight of stairs.

As input, you are given an array listing the number of steps in each flight of stairs in the stairwell. You also receive the number of steps you can cover with each stride (you could climb 2 steps per stride, or 3 steps per stride if you were tall and fit).

The stairwell has between 1 and 30 flights inclusive. Each flight can have a maximum of 20 steps. You can stride between 1 and 4 steps inclusive.

The solution will calculate the minimum number of strides necessary to get to the top of the stairwell.

Requirements

  • Java 1.8

How to build

On Unix:

./gradlew clean build

On Windows:

gradlew.bat clean build

How to run

On Unix:

./gradlew run

On Windows:

gradlew.bat run

How to use

The app exposes 1 endpoint http://localhost:8080/steps

Params

Name Required example
stepsPerFlight YES [17]
stepsPerStride YES 3
curl http://localhost:8080/steps?stepsPerFlight=\[17\]&stepsPerStride=3

climbing_stairs's People

Contributors

rucksacklabs avatar

Watchers

James Cloos 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.