about | help | code help+videos | done | prefs |
A row of black and white square tiles need to be placed across a wall such that the first and last tiles are black and the tiles alternate in color. The tiles may have no spaces in between but there may be an even gap at the beginning and end. Given the total width of the wall and the tile size, your task is to maximize the number of tiles and calculate the gap. Return the result as a string in the format "num_tiles gap_size". If the total width was 100 inches with 5 inch tiles, the function would return "19 2.5" as you may place 19 tiles in this fashion and have a 2.5 inch gap on the ends. You may assume at least 3 tiles will fit on the wall. tiles(100, 5) → '19 2.5' tiles(10, 2) → '5 0.0' tiles(50, 13) → '3 5.5' ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290 Post-solution available
Copyright Nick Parlante 2017 - privacy