GARDENSQ - Editorial

PROBLEM LINKS

Practice
Contest

DIFFICULTY

EASY

EXPLANATION

The elegance of the garden could be easily calculated in O(N * N * N) time. A quick look at the limits should give you ample amount of confidence for the same! There were no mysteries. There were no intricacies. But, that’s how a trivial problem is expected to be.

Simply iterate over the top left cell of any square (N * N) and then the size (N). Checking for whether a square is valid or not is constant time. Just check whether the four corners are the same color.

SETTER’S SOLUTION

Can be found here.

TESTER’S SOLUTION

Can be found here.

this solution is first to arrive!

//