Codility RectangleBuilderGreaterArea Java solution

preview_player
Показать описание
Rectange Builder Greater Area is the first task in exercise 2 of Codility. The aim is to count how many rectangular sheep pens, over a specified area, that can be built from a list of fences. The fences are specified in an array where the numbers represent the lengths of the fences.

My solution first counts the fences and checks how many square pens we can build. The initial loop saves fences in a list if we have two fences of the same length. It uses two pointers to this list and moves through efficiently to count how many rectangular pens can be built. The solution scores 100%.
Рекомендации по теме
Комментарии
Автор

Thanks, Dave! Your videos are being very helpful to me

PauloHenrique-pxfp
welcome to shbcf.ru