Git Product home page Git Product logo

gossip-buss-kata's Introduction

Gossiping Bus Drivers Kata

Source

Description taken from Katalog

Description

Bus drivers like to gossip, everyone knows that. And bus drivers can gossip when they end up at the same stop.

So now we are going to calculate after how many stops all the bus drivers know all the gossips.

You will be given a number of bus routes that the drivers follow.

Each driver starts with one gossip. Each route is appointed to 1 driver.

When 2 or more drivers are at the same stop (even if it is the start), they can exchange all the gossips they know.

A route looks like this: 1 2 3 4 and is repeated over the whole day like this 1 2 3 4 1 2 3 4 1 2 3 โ€ฆ If a driver starts and stops at the same stop then that is also repeated.

All drivers take 1 minute to go from one stop to another and the gossip exchange happens instantly.

All drivers drive 8 hours a day so you have a maximum of 480 minutes to get all the gossiping around.

You will receive all the driver routes. Not all drivers have a route of the same length

Example 1

3 1 2 3
3 2 3 1
4 2 3 4 5

Example 2

2 1 2
5 2 8

Results

The number of stops it takes to have all drivers on board with the latest gossips.

If there is even one driver who does not have all the gossips by the end of the day, the answer is never.

Example 1: 5

Example 2: never

gossip-buss-kata's People

Contributors

sdecandelario avatar

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.