Use of dynamic array instead of static

we are using a dynamic array in this problem to reduce the space complexity, right?
because I can’t see any other use of keep that memory reserved.

@Naman-Bansal-2736674666374052 yes that is the purpose of using dynamically allocated array.