Large 2d matrix

I want to create a 2d matrix of size 3000000 X 3000000.When I am declaring the array in java I am getting NZEC error and SIGSEV in C++.
How to declare a array of large size in Java and C++.

You cannot declare such a large array as it is not possible for the system to allot so many Gigabytes of continuous memory.The system throws a memory error so you get NZEC. You will need to come up woth a more space efficient algorithm

1 Like

Could you tell me the right approah?

Obviously not!! This is live contest question. I am closing this thread now. Please put in some more effort over the weekend. You will be able to solve it. Good Luck.

I’d really like to initialize the array of 32TB in few seconds…