Skip to content

Latest commit

 

History

History
10 lines (6 loc) · 487 Bytes

(7 kyu) Simple beads count.md

File metadata and controls

10 lines (6 loc) · 487 Bytes

Simple beads count (7 kyu)

https://www.codewars.com/kata/simple-beads-count

Two red beads are placed between every two blue beads. There are N blue beads. After looking at the arrangement below work out the number of red beads.

@ @@ @ @@ @ @@ @ @@ @ @@ @

Implement count_red_beads(n) (in PHP count_red_beads($n); in Java, Javascript, C, C++ countRedBeads(n)) so that it returns the number of red beads. If there are less than 2 blue beads return 0.