Share your repls and programming experiences

← Back to all posts
6
ReplProblemOfTheWeek #3 - Buildings

(I have no clue how hardit does this, so imma do this my way)

Welcome to the 3rd repl.it problem of the week!

This week's problem - buildings

You are standing in front of a lot of buildings for some reason, and they are somehow lined up in a single line. Many of these buildings are different heights, so some are taller or shorter than others.

Part A

You need to figure out how many buildings that you can see.
For example, given 2, 3, 1, 4 (each number is the height of the building), you can see the first, second, and fourth buildings, because the second building is taller than the third.

Part B

You need to figure out how many buildings of each height that you can see.
For example, given 2, 3, 1, 3, 2, 4, 3, 4, you can see:

  • 1 building with a height of 2
  • 1 building with a height of 3
  • and 1 building with a height of 4

Post your answers here: https://repl.it/talk/share/RPOTW-3-answers/9408

Loading Repl
Commentshotnewtop
2
1

Let me know if you have any questions about the problem (I'm not giving you the answer tho)