Suppose there is problem statement where i need a number with constraints as, it is should be <= 10^8
but instead of using ‘int’ I use ‘long long int’ , how is that gonna affect on space complexity, or what would be it’s advantage or disadvantage if any ??
Type Modifiers and Range Overflow
hi @Karanveer,
The space complexity will be same of both int and long long.
Reason:
let’s say there is code with O(n) complexity.
Case1 : Using int (4bytes)
Space complexity of this code will be O(n4) which is O(n) only.
Case1 : Using long long (8bytes)
Space complexity of this code will be O(n8) which is O(n) only.
There will be no disadvantage you can use any.
Please let me know if there is any other doubt.
thanks for helping…
1 Like
Hi, looks like you reopened this doubt by mistake.
I see you’ve been already replied.