Git Product home page Git Product logo

stairwell's Introduction

Stairwell

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.

#Examples: Input: {17}, StepsPerStride: 3, Returns: 6 A stairwell with a single flight of with 17 steps. In 5 strides, you've climbed 15 steps. You’ve two steps left to reach top, which you can cover in 1 stride.

Input: {17, 17}, StepsPerStride: 3, Returns: 14 A similar stairwell, but with 2 flights separated by a landing. 6 strides to the landing, 2 strides to turn, and 6 more strides to get to the top.

Input: {4,9,8,11,7,20,14}, StepsPerStride: 2, Returns: 50

stairwell's People

Stargazers

Roman avatar

Watchers

Thales Andrade 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.