Skip to content

constk/WaterOverflow

Repository files navigation

WaterOverflow

TDD of Water Overflow Problem

This repository contains the code for the Water Overflow problem solved with Test Driven Development.

The problem is stated as follows:

There is a stack of water glasses in a form of triangle as illustrated. Each glass has a 250ml capacity. When a liquid is poured into the top most glass any overflow is evenly distributed between the glasses in the next row. That is, half of the overflow pours into the left glass while the remainder of the overflow pours into the right glass. Image illustrating the problem: i and j are zero based.

Write a program that is able to calculate and illustrate how much liquid is in the j’th glass of the i’th row when K litres are poured into the top most glass.

In this solution, I am attempting to demonstrate how tests drive design and development and I am not aiming for 100% accuracy of solution.

About

TDD of Water Overflow Problem

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages