We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LeetCode 905. 按奇偶排序数组 思路: (1)新建一个数组 (2)对原数组进行遍历,如果为奇数则添加到末尾,如果为偶数则添加到前面
之前用过sort,还真没不知道竟然是这样的sort!他会将元素转换为字符串,再根据字符串的第一个字母对应的ASCLL码来排序的。 弄不懂为什么和其他的高阶函数不一样,他直接修改了原数组。
The text was updated successfully, but these errors were encountered:
js语言不是很熟,没看懂sort干了啥,不过大致意思明白了。感觉可以优化一下哈,比如:(1)能不能不用额外数组?(2)能不能O(logn)时间复杂度?
Sorry, something went wrong.
看了 83、905 文件命名和代码中的变量命名可以多斟酌下
No branches or pull requests
LeetCode 905. 按奇偶排序数组
思路:
(1)新建一个数组
(2)对原数组进行遍历,如果为奇数则添加到末尾,如果为偶数则添加到前面
之前用过sort,还真没不知道竟然是这样的sort!他会将元素转换为字符串,再根据字符串的第一个字母对应的ASCLL码来排序的。
弄不懂为什么和其他的高阶函数不一样,他直接修改了原数组。
The text was updated successfully, but these errors were encountered: