c++
\nclass Solution {\npublic:\n    int maxTrailingZeros(vector<vector<int>>& g) {\n       \n     int col=g[0].size();\n     int row=g.size();   \n     int a[row][
```\nclass Solution {\npublic:\n    int maxTrailingZeros(vector<vector<int>>& g) {\n       \n     int col=g[0].size();\n     int row=g.size();   \n     int a[row][col],b[row][col];  \n     for(int i=0;i<row;i++)\n     {\n         int cnt5=0,cnt2=0;\n         for(int j=0;j<col;j++)\n         {\n           \n            int x=g[i][j];\n            while(x%5==0)\n            {\n                cnt5++;\n                x/=5;\n            }\n            while(x%2==0)\n            {\n                cnt2++;\n                x/=2;\n            }\n            a[i][j]=cnt5;\n            b[i][j]=cnt2; \n          \n         }\n         \n     }\n        \n     \n     int maxi=0;   \n     for(int j=0;j<col;j++)\n     {\n        int cnt5=0,cnt2=0; \n        for(int i=0;i<row;i++)\n        {\n            int val5=cnt5+a[i][j];\n            int val2=cnt2+b[i][j];\n            int rval5=cnt5+a[i][col-1]-(j==0?0:a[i][j-1]);\n            int rval2=cnt2+b[i][col-1]-(j==0?0:b[i][j-1]);  \n            cout<<a[i][col-1];\n            int mini1=min(val2,val5);\n            int mini2=min(rval2,rval5);\n           \n            int maxis=max(mini1,mini2);\n            maxi=max(maxi,maxis);  \n           \n            int x=g[i][j];\n            while(x%5==0)\n            {\n                cnt5++;\n                x/=5;\n            }\n            while(x%2==0)\n            {\n                cnt2++;\n                x/=2;\n            }\n          \n                      \n        }\n         \n     }   \n        \n     for(int j=0;j<col;j++)\n     {\n        int cnt5=0,cnt2=0; \n        for(int i=row-1;i>=0;i--)\n        {\n            int x=g[i][j];\n            int val5=cnt5+a[i][j];\n            int val2=cnt2+b[i][j];\n             int rval5=cnt5+a[i][col-1]-(j==0?0:a[i][j-1]);\n            int rval2=cnt2+b[i][col-1]-(j==0?0:b[i][j-1]);  \n          \n            int mini1=min(val2,val5);\n            int mini2=min(rval2,rval5);\n            \n            int maxis=max(mini1,mini2);\n            maxi=max(maxi,maxis);\n            while(x%5==0)\n            {\n                cnt5++;\n                x/=5;\n            }\n            while(x%2==0)\n            {\n                cnt2++;\n                x/=2;\n            }\n               \n            \n        }\n\n     }\n         \n       return maxi; \n        \n        \n        \n    }\n};\n```
[]