Dec-17-2017, 04:23 PM
Quote:O(1) (n being the length of str1 or str2) would mean that the calculation time is independent of the length of str1 or str2I only came to a conclusion of
O(1)
because, im not looping through the entire string str1 or str2. Since im using list slicing technique, from an application respective it appears that each line of code in function zigzag was touched once
. Do you still believe its O(n)
?I agree with the space complexity.