#6
Day 6
Photo by Dominik Scythe on Unsplash
The Problem
Read More »#6Write an algorithm that finds the total number of set bits in all integers between
https://dailycodingproblem.com1
andN
Day 6
Photo by Dominik Scythe on Unsplash
Read More »#6Write an algorithm that finds the total number of set bits in all integers between
https://dailycodingproblem.com1
andN
Day 3
Photo by Mateusz Delegacz on Unsplash
A wall consists of several rows of bricks of various integer lengths and uniform height. Your goal is to find a vertical line going from the top to the bottom of the wall that cuts through the fewest number of bricks. If the line goes through the edge between two bricks, this does not count as a cut.
For example, suppose the input is as follows, where values in each row represent the lengths of bricks in that row
[[3, 5, 1, 1],
[2, 3, 3, 2],
[5, 5],
[4, 4, 2],
[1, 3, 3, 3],
[1, 1, 6, 1, 1]]
Read More »#3The best we can we do here is to draw a line after the eighth brick, which will only require cutting through the bricks in the third and fifth row.
https://dailycodingproblem.com
Given an input consisting of brick lengths for each row such as the one above, return the fewest number of bricks that must be cut to create a vertical line.
Day 1
Read More »#1You are given an array representing the heights of neighboring buildings on a city street, from east to west. The city assessor would like you to write an algorithm that returns how many of these buildings have a view of the setting sun, in order to properly value the street.
For example, given the array
https://dailycodingproblem.com[3, 7, 8, 3, 6, 1]
, you should return3
, since the top floors of the buildings with heights8
,6
, and1
all have an unobstructed view to the west.