why is the space complexity of reverse function in this case??? shilundt it be O(1) ??
Space complexxity of reverse
You are taking an extra string variable to store the reversed string
string rev = s
This is why space complexity is not O(1)
why is the space complexity of reverse function in this case??? shilundt it be O(1) ??
You are taking an extra string variable to store the reversed string
string rev = s
This is why space complexity is not O(1)