Thank you. So for the following code, which is used to get all the sub string with length k from a string:
function fun1(str, k) {
let rtn = [];
for (let i = 0; i < str.length - k + 1; i++) {
let current = str.substr(i, k);
rtn.push(current)
}
return rtn;
}
the time complexity is O(n*k), which is approximated to O(n), right? I guess so. Thank you.