Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

1

Performance Time complexity for your algorithm is \$O(N²+N²/2)\$. If you find a way to combine Transpose \$O(N²)\$ and ReverseCols \$O(N²/2)\$ in a single run, you could get \$O(N²)\$ in worst case. Edit: given Henrik's good eye, you have already come up with a solution before that adheres to the optimized complexity. So, apply it here.


2

if (!isNaN(str1[i]) && !isNaN(str2[i])) { // if both chars are numbers, return str with numerically smaller number return parseInt(str1.slice(i)) < parseInt(str2.slice(i)) ? str1 : str2; } seems like a bug. In case the numbers compare equal the code blindly returns the first string. Consider (a10c, a10b). return str1; // if we ...


Top 50 recent answers are included