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.
Yes, a "growable" array is important to this problem. Look at the constraints. In a 2D array construction, you would need to reserve a 20000x50000 array to make sure you can store all the data sets. That's 4 GB for int! Google "array of arraylist java" for more in-depth discussions.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Arraylist
You are viewing a single comment's thread. Return to all comments →
Yes, a "growable" array is important to this problem. Look at the constraints. In a 2D array construction, you would need to reserve a 20000x50000 array to make sure you can store all the data sets. That's 4 GB for int! Google "array of arraylist java" for more in-depth discussions.