Rectangles in N*N Board
Easy Accuracy: 7.15% Submissions: 42 Points: 2

Find total number of Rectangles (excluding squares) in a N*N chessboard.

 

Example 1:

Input:
N = 1
Output:
0
Explanation:
There is only 1 square on a 1*1 chess
board. There are no Proper Rectangles.

Example 2:

Input:
N = 2
Output:
4
Explanation:
There are 4 rectangles in a 2*2 chessboard.

 

Your Task:
You don't need to read input or print anything. Your task is to complete the function rectanglesInChessBoard() which takes an Integer N as input and returns the number of rectangles in a N*N chess board.

 

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

 

Constraints:
1 <= N <= 105

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Output Window