For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
Pinterest app screen is two columns of images (pins). Each pin has a top and bottom index (top < bottom), and has a column represented by "L" or "R". Given an unsorted list of non-overlapping pins like:
pins = [(top_ind,bottom_ind,column),...,] and a screen_length of screen_len
Return the maximum number of pins the user can possibly see (fully). That is, complete this:
def get_max_pins(pins,screen_len):
max_pins = 0
...
return max_pins
Example:
input:
pins = [(1,4,"L"),(2,3,"R"),(4,8,"R"),(6,9,"L")]
screen_len = 5
output: 2
Followup: support a variable number of columns.
Pinterest app screen is two columns of images (pins). Each pin has a top and bottom index (top < bottom), and has a column represented by "L" or "R". Given an unsorted list of non-overlapping pins like:
pins = [(top_ind,bottom_ind,column),...,] and a screen_length of screen_len
Return the maximum number of pins the user can possibly see (fully). That is, complete this:
def get_max_pins(pins,screen_len):
max_pins = 0
...
return max_pins
Example:
input:
pins = [(1,4,"L"),(2,3,"R"),(4,8,"R"),(6,9,"L")]
screen_len = 5
output: 2
Followup: support a variable number of columns.
Output