Can someone help to write a function to give demonstrate the functionality of 3D matrix in 1D matrix.
Function Prototype:
void set (int value,int indexX,int indexY,int indexZ, int [] 1dArray);
Following pattern may be useful
Taking an example for 2D which can be enhanced for 3D and further
A(ij) = 1 2 3 4 5 6 7 8 9
R = elements in one row
B(x) = 1 2 3 4 5 6 7 8 9
x = (i * R) + j
How to implement a function to check whether there is a path for a string in a matrix of characters? It moves to left, right, up and down in a matrix, and a cell for a movement. The path can start from any entry in a matrix. If a cell is occupied by a character of a string on the path, it cannot be occupied by another character again.
You have a 2D matrix. Only two ZEROs in matrix. Find the path from 1st zero to 2nd zero with least sum.
1 6 8 9 0 3 4 9 -5 5 11 13 8 9 44 23 15 -20 7 9 7 -13 14 11 0 16 23 31 16 7 67 5 4 23 21 19
Answer
1 6 8 9 0 ----> 3 | 4 9 -5 5 11 13 | 8 9 44 23 15 -20 | 7 <---- 9 <---- 7 <--- -13 <--- 14 <--- 11 | 0 16 23 31 16 7 67 5 4 23 21 19
Given a matrix with 1s and 0s, please find the number of groups of 1s. A group is defined by horizontally or vertically adjacent 1s.