Problem Statement | |||||||||||||
You have a list of rectangles divided into groups. The index of a group is the sum of the areas of all the rectangles in the group. You are to determine the group with the biggest index. You are given a String[] rectangles. Each element of rectangles represents a single rectangle, and is formatted as "G L W", where G is the name of the group to which the rectangle belongs, L is the rectangle's length, and W is the rectangle's width. Return a String formatted as "G I", where G is the name of the group with the maximal index, and I is the index of that group with no leading zeroes. If there are multiple groups with the same maximal index, return the one whose name comes first alphabetically. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | rectangles will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of rectangles will be formatted as "G L W", where G is an uppercase letter ('A' - 'Z') and L and W are integers with no leading zeroes. | ||||||||||||
- | Each L and W will be between 1 and 1000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|