Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

Click here to see the full article post

Why is sorting O(nlogn)? Is the worst case O(nlogn*x) when you have to compare s1 and s2 for n/2 times?

@zestypanda Yes, you are right. Updated. Thanks

isn't in place merge sort O(1) space?

I do not think that your time complexities are correct. The isSubsequence method is O(m) where m is the size of the input string s. This means that the complexity overall should be O(n*m).

I had a similar idea as #4 but my isSequence is wrong somehow (fails on #29), can anyone see what is wrong?

int i = 0; for(char c : dict.toCharArray()) { while(s.charAt(i) != c) { if(++i == s.length()) { return false; } } }

Nevermind, it'd fail on d of "bb" and s of "b"

Can someone please tell me how the time complexity of sorted solution is O(nxlogn + nx) ? i thought it is O(nlogn + nx).

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.