Given a N * N chessboard, the task is to count the number of squares having the odd side length.
Input: N = 3
9 squares are possible whose sides are 1
and a single square with side = 3
9 + 1 = 10
Input: N = 8
Approach: For all odd numbers from 1 to N and then calculate the number of squares that can be formed having that odd side. For the ith side, the count of squares is equal to (N – i + 1)2. Further add all such count of squares.
Below is the implementation of the above approach:
- Area of Triangle using Side-Angle-Side (length of two sides and the included angle)
- Number of squares of side length required to cover an N*M rectangle
- Puzzle | Program to find number of squares in a chessboard
- Find the side of the squares which are inclined diagonally and lined in a row
- Find the side of the squares which are lined in a row, and distance between the centers of first and last square is given
- Length of diagonals of a Rhombus using length of Side and vertex Angle
- Count Distinct Rectangles in N*N Chessboard
- Count positions in a chessboard that can be visited by the Queen which are not visited by the King
- Count of perfect squares of given length
- Check if a number has an odd count of odd divisors and even count of even divisors
- Area of a n-sided regular polygon with given side length
- Minimum and maximum possible length of the third side of a triangle
- Length of remaining two sides of a Triangle from a given side and its adjacent angles
- Find the area of rhombus from given Angle and Side length
- Check if a king can move a valid move or not when N nights are there in a modified chessboard
- Minimum Cuts can be made in the Chessboard such that it is not divided into 2 parts
- Number of blocks in a chessboard a knight can move to in exactly k moves
- Total position where king can reach on a chessboard in exactly M moves
- Chessboard Pawn-Pawn game
- Check if a Queen can attack a given cell on chessboard
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.