Detail Form
We will send your result on your email id and phone no. please fill detail
Given a single integer N, your task is to find the sum of the square of first N odd natural Numbers.
Example 1:
Example 2:
Your Task:
You don't need to read or print anything. Your task is to complete the function sum_of_square_oddNumbers() wgich takes N as input parameter and returns the sum of first N odd natural numbers.
Expected Time Complexity: O(1)
Expected Space Complexity: O(1)
Constraints:
1 <= N <= 10000
The problem is to check whether the decimal representation of a given binary number is divisible by 5 or not.
Input:
First line consists of T test cases. Only line of every test case consists of Binary string.
Output:
Print "Yes" if it is divisible by 5, else "No" (without quotes).
Constraints:
1<=T<=100
1<=|length of binary string|<=100
Example:
Input:
2
1010
10000101001
Output:
Yes
Yes
Given a matrix mat[][] of n rows and m columns, consisting of 0’s and 1’s. The task is to complete the function findPerimeter which returns an integer denoting the perimeter of sub-figures consisting of only 1’s in the matrix.
For example
Perimeter of single 1 is 4 as it can be covered from all 4 side. Perimeter of double 11 is 6.
| 1 | | 1 1 |
Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. The first line of each test case contains two space separated n and m denoting the size of the matrix mat[][] . Then in the next line are n*m space separated values of the matrix.
Output:
For each test case in a new line print the perimeter of sub-figure consisting only 1’s in the matrix.
Constraints:
1<=T<=100
1<=n, m<=20
Example(To be used for expected output):
Input:
2
1 2
1 1
3 3
1 0 0 1 0 0 1 0 0
Output:
6
8
Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.