Space complexity doubt?


#1

point to note is rand() is constant time AND constant space therefore rand() when added to a or b does not result in a random increase in value of either variable.
even if both loops run for a really long time space complexity will therefore be 0(1) ie constant