Memory management in c++/Java

Hi All!

I have a doubt. For example if a question specifies memory limit of 50000 Bytes then shouldn’t this figure vary for different languages. Languages like c++ and c takes much less memory than Java, didn’t they?

Kindly correct me in case I am missing something. Thanks!

50000 bytes is the source limit, i.e. the maximum size of your source code. The maximum memory available at runtime is 1536 MB as described here. These numbers are the same for all the languages.

You are right, that the memory consumption depends on the language you use, but 1536 MB is more than enough for most of the problems and languages (if not for all of them). If you hit this limit, you should consider using a better data structure and/or a better algorithm.