Click here to see the full article post
Isn't the complexity of string.split(regex) function "O(n)"? So how can splitting take O(1) time?
maximum length of the string will be less than 20(approx), so it can be treated as a constant.
String split is definitely O(N) as @aneeshak has mentioned. Source : http://softwareengineering.stackexchange.com/a/331951
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.