I got the following code and was told that Big O for the func function is Big O (n^ 2). I believe it is Big O(n) since it is should Big O(n + n), am I wrong?
what is Big O of following func?
nums = list(range(1, 11))
K = 4
def func(nums: list, K:int):
i, end = 0, len(nums)
res = []
x = []
while i < end:
res.append(nums[i:i+K])
i += K
for i in res:
x += i[::-1]
return x
func(nums, K)