You are given N unit squares (squares with side length 1 unit), the task is to make rectangles using these squares and to count the number of rotationally unique rectangles. Two rectangles are rotationally unique if one can’t be rotated to become equivalent to the other one.
Input:N = 4Output:5Explanation:Total rectangles we can make from 4
unit squares are: 1x1, 1x2, 1x3, 2x2,
1x4, 2x1, 3x1, and 4x1.
But we can get 2x1, 3x1, 4x1
by rotating 1x2, 1x3, 1x4.
So these five rectangles are rotationally unique.
1x1, 1x2, 2x2, 1x3 and 1x4.
Input:N = 5Output:6Explanation:We can make only 6 rotationally unique
rectangles from 5 unit squares.
You don't need to read input or print anything. Your task is to complete the function noOfUniqueRectangles() which takes an Integer N as input and returns the answer.
Expected Time Complexity: O(N*sqrt(N)) Expected Auxiliary Space: O(1)