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.
- Prepare
- Data Structures
- Arrays
- Dynamic Array
- Discussions
Dynamic Array
Dynamic Array
Sort by
recency
|
2020 Discussions
|
Please Login in order to post a comment
Time complexity: O(n)
Space complexity: O(n), if deallocates dynamic array
finding the solution for this question is not the problem, but trying to understand.
tips if it helps,
You need two array:
What are queries: example of provided sample data
Here is my c++ solution, you can watch the explanation here : https://youtu.be/MYdQxgmJ4Sk
public static List dynamicArray(int n, List> queries) { // Write your code here List> arr = new ArrayList<>(); for (int i = 0; i < n; i++) { arr.add(new ArrayList<>()); }
I really don't understand what it wanted me to do. it doesn't complicate, but i have to research to understand that what it really wanted me to do