Neebal Technologies interview question

Asked to explain time complexity and space complexity of each code?