I’m using a 3d dimensional array with O(NNk) space complexity and I got a memory limit exceeded warning. Can I do better than this?
Memory Limit Exceeded!
yes. you can do better. You can use 3d array of O(2NN). How? Look at your recursive function.