Regarding space complexity

Generally, an array of 10^6 gives memory limit exceeded, but in this problem, we are using a space of 10^7 and still passing the test case. The memory limit in this question is 1024 MB. Can you give a general idea of space complexity vs memory occupied

@tilakparth123 space complexity is the order of space required according to the size of input, example : for inputting an array of size n you require O(n) space, whereas for inputting a 2D (square)array of side n you need O(nn) space.
Memory occupied deals with exact bytes takes by your program, an int takes 4 bytes(32 bits), so an array of size 10^7 will take 4
10^7 bytes (almost 40 MB) which is much lesser than provided. Also generally an array of 10^6 does NOT gives memory limit exceeded

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.