1.

Given a single integer N, your task is to find the sum of the square of first N odd natural Numbers.
 

Example 1:

Input: 2
Output: 10
Explanation: 12 + 32 = 10

Example 2: 

Input: 3
Outptut: 35
Explanation: 12 + 32 + 52 = 35

 

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

2.

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

3.

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.

4.

You are given a Binary tree. You are required to find the number of pairs violating the BST property. In BST every element in left subtree must be less than every element in the right subtree. You are required to complete the function pairsViolatingBST(Node *root, int N).

 

Input:

The first line consists of an integer T denoting the number of test cases. Each test case consists of two lines. The first line of each test case consists of a single integer N, denoting the number of edges in the Binary tree. The next line contains the edges of the binary tree. Each edge consists of two integers and one character first of whose is parent node, second is child node and character "L" representing Left child and "R" representing the right child. 
 

Output:

You are required to complete the function pairsViolatingBST(Node *root, int N) which takes the root of the tree and the number of edges N as the arguments. The function returns the required number of pairs. As the results can be large, return your result modulo 10^9 + 7 

Constraints:

1 <= T <= 1000                

1 <= N < 10^5     

 

Example:

Input:

2

6

50 30 L 50 60 R 30 20 L 30 25 R 60 10 L 60 40 R

2

4 5 L 4 6 R

Output:

7

1

5.

Given a grid of dimension nxm containing 0s and 1s. Find the unit area of the largest region of 1s.
Region of 1's is a group of 1's connected 8-directionally(horizontally, vertically, dioganally).
 

Example 1:

Input: grid = {{1,1,1,0},{0,0,1,0},{0,0,0,1}}
Output: 5
Explanation: The grid is-
1 1 1 0
0 0 1 0
0 0 0 1
The largest region of 1's is colored
in orange.

Example 2:

Input: grid = {{0,1}}
Output: 1
Explanation: The grid is-
0 1
The largest region of 1's is colored in
orange.

 

Your Task:
You don't need to read or print anyhting. Your task is to complete the function findMaxArea() which takes grid as input parameter and returns the area of the largest region of 1's.

Expected Time Complexity: O(n*m)
Expected Auxiliary Space: O(n*m)
 

Constraints:
1 ≤ n, m ≤ 500