In this HackerEarth Prime cells problem solution, You are given a matrix of rows and columns. You are required to maximize the size of a prime cell. A prime cell is the largest group of connected cells. A cell may only be connected with its adjacent cells in the direction up, down, left, and right that has the same count of prime factors. You are allowed to perform any number of operations. In one operation, you can change a number to another number. A cost is associated to change the number. This cost is the absolute difference between the highest prime factors of both the numbers. The maximum value of the modified matrix should not exceed the maximum value of the input matrix.

HackerEarth Prime cells problem solution

HackerEarth Prime cells problem solution.

using namespace std;
int main() {