Title: #905 - Sort Array By Parity - LeetCode JavaScript Solutions
Open Graph Title: #905 - Sort Array By Parity - LeetCode JavaScript Solutions
X Title: #905 - Sort Array By Parity - LeetCode JavaScript Solutions
Description: Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array tha...
Open Graph Description: Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array tha...
X Description: Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array tha...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/sort-array-by-parity
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/sort-array-by-parity","name":"#905 - Sort Array By Parity - LeetCode JavaScript Solutions","description":"Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array tha...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar sortArrayByParity = function(nums) {\n return nums.sort((a, b) => a % 2 === 0 ? -1 : 1);\n};","keywords":"LeetCode 905, #905 - Sort Array By Parity, Easy, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/sort-array-by-parity |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/sort-array-by-parity/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0905-sort-array-by-parity.js |
| Array | https://leetcodejavascript.com/tags/array |
| Sorting | https://leetcodejavascript.com/tags/sorting |
| Two Pointers | https://leetcodejavascript.com/tags/two-pointers |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow