Infosys | Power programmer Role | Onsite

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-01-31Added By Anonymous
Source: Link
Infosys | Power programmer Role | Onsite

1. Alexa has recently found N building blocks in the shape of a cylinder Each block has a radius and a height. She wants to build a fence by stacking some of those building blocks one over the other in any order she wants In order to put block X over block Y, radius and height of X should be strictly smaller than Y Your task is to find Maximum height of fence she can build. return answer in modulo 10 ** 9 + 7 Example: N --> 3 Radius --> 1 2 3 Height --> 1 3 2 OUTPUT 4 EXPLAINATION To get Maximum height use blocks 1 and 2 Example:
3
1 1 1
2 3 5
OUTPUT: 5
Use only block 3, as you cant stack any other block over other Example:
2
4 1
3 7
OUTPUT: 7
Use block 2
Comments