can you explain it for a bit? I have a hard time understand it, as well as this bit operation. why does add them together yield the correct result?
Posts made by xiaoqin
Why is this wrong?
class Solution: # @param nums, a list of integer # @param k, num of steps # @return nothing, please modify the nums list in-place. def rotate(self, nums, k): if len(nums) is 1: return nums result =  a = -1 * (k % len(nums)) for i in range(len(nums)): result.append(nums[a]) a += 1 return result
This is my code, it work on my local for the case: [1, 2] 1