We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I don't think that's possible, and the compiler will prevent you from creating such a data structure. This is because, when the compiler goes to allocate memory fo this 2-d data structure, it won't know how much memory to allocate, since it doesn't know the size of each item in array[] (since they're variable size ArrayLists).
You can still try it out to see how the compiler responds.
Dynamic Array
You are viewing a single comment's thread. Return to all comments →
I don't think that's possible, and the compiler will prevent you from creating such a data structure. This is because, when the compiler goes to allocate memory fo this 2-d data structure, it won't know how much memory to allocate, since it doesn't know the size of each item in array[] (since they're variable size ArrayLists).
You can still try it out to see how the compiler responds.
HackerRank solutions.