Shift interview question

Medium level Leetcode problems with follow ups about time and memory complexity.