what does *arr = new int[n] mean ? Why are we using pointers here? we can’t solve this problem without pointers?
Sum of 2-D subarray
Hey @vanshikasharma1645,
Here **arr is used to represent 2-D matrix(pointer of pointer), and *arr=new int[n] represents making a new row with N integers. If you don’t want to get into complexities of pointers you can simply use vector of vector, i.e. the matrix can be represented as vector<vector< int > > arr(n , vector (m)) this represents a 2D vector with n rows and m columns.
Hope this helps.