Time complexity of python slice operation

what is the time complexity of slicing in python. Example:


I wrote a program in leetcode with lis slicing and without lis slicing and still got the same time result.

the time complexity of slicing in python is O(k) please visit https://wiki.python.org/moin/TimeComplexity#list for more.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

O(n) where n is the length of the slice. Slicing is just “copy part of the list” so time complexity is the same as copy. O(n+k) is the average case, which includes having to grow or shrink the list to adjust for the number of elements inserted to replace the original slice.