Please write coding for the following two problems and submit code through comments. Thanks in advance

1. You are given a function,

The function takes a two-dimensional array having equal number of rows and columns (i.e. a square matrix) and its dimension, 'n', as input. Implement the function such that it returns the maximum product that can be formed from four adjacent numbers. Numbers can be adjacent to each other in either of the given directions: up, down, left, right, diagonal or anti-diagonal. Ensure that four adjacent numbers are chosen in such a way that the direction does not change while choosing the numbers. Assume 'n' >= 4.

5

1 2 3 4 5

6 7 8 9 1

2 3 4 5 6

7 8 9 1 0

9 6 4 2 3

3024

Here, the numbers 6, 7, 8, 9 in the second row, which are horizontally adjacent form the product 3024 which is the maximum product of any four adjacent numbers in the given array.

1. You are given a function,

```
void
FindOnesInBinaryString(char* str);
```

The
function takes a binary string i.e. a string comprising of '0's and '1's as
input. Implement the function such that it prints the indices of the first
occurrences of three equi-spaced ones, to the standard output (STDOUT). The
algorithm to find out the indices of the evenly spaced ones is given as
follows:

Find the distance between the first and second '1's and the second and third '1's. If these distances are equal, then their indices are the answer. Else repeat the process for the entire array until three such '1's are found.

1. Indices start from 0.

2. If no equi-spaced '1's are found, then print '-1'

011001001000001

2

5

8

The distance between the '1's at positions 2, 5 and 8 is 2, hence these are the indices of first occurrence of three equi-spaced 1's.

Find the distance between the first and second '1's and the second and third '1's. If these distances are equal, then their indices are the answer. Else repeat the process for the entire array until three such '1's are found.

**Note:**1. Indices start from 0.

2. If no equi-spaced '1's are found, then print '-1'

**Example:****Input:**011001001000001

**Output:**2

5

8

**Explanation:**The distance between the '1's at positions 2, 5 and 8 is 2, hence these are the indices of first occurrence of three equi-spaced 1's.

**********************************************

2. You are given a function,

```
int
FindMaxProduct(int** arr, int n);
```

The function takes a two-dimensional array having equal number of rows and columns (i.e. a square matrix) and its dimension, 'n', as input. Implement the function such that it returns the maximum product that can be formed from four adjacent numbers. Numbers can be adjacent to each other in either of the given directions: up, down, left, right, diagonal or anti-diagonal. Ensure that four adjacent numbers are chosen in such a way that the direction does not change while choosing the numbers. Assume 'n' >= 4.

**Example:**

**Input:**

5

1 2 3 4 5

6 7 8 9 1

2 3 4 5 6

7 8 9 1 0

9 6 4 2 3

**Output:**

3024

**Explanation:**

Here, the numbers 6, 7, 8, 9 in the second row, which are horizontally adjacent form the product 3024 which is the maximum product of any four adjacent numbers in the given array.