File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 151
151
876|[ Middle of the Linked List] ( ./0876-middle-of-the-linked-list.js ) |Easy|
152
152
884|[ Uncommon Words from Two Sentences] ( ./0884-uncommon-words-from-two-sentences.js ) |Easy|
153
153
890|[ Find and Replace Pattern] ( ./0890-find-and-replace-pattern.js ) |Medium|
154
+ 905|[ Sort Array By Parity] ( ./0905-sort-array-by-parity.js ) |Easy|
154
155
916|[ Word Subsets] ( ./0916-word-subsets.js ) |Medium|
155
156
925|[ Long Pressed Name] ( ./0925-long-pressed-name.js ) |Easy|
156
157
929|[ Unique Email Addresses] ( ./0929-unique-email-addresses.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 905. Sort Array By Parity
3
+ * https://leetcode.com/problems/sort-array-by-parity/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given an integer array nums, move all the even integers at the beginning of
7
+ * the array followed by all the odd integers.
8
+ *
9
+ * Return any array that satisfies this condition.
10
+ */
11
+
12
+ /**
13
+ * @param {number[] } nums
14
+ * @return {number[] }
15
+ */
16
+ var sortArrayByParity = function ( nums ) {
17
+ return nums . sort ( ( a , b ) => a % 2 === 0 ? - 1 : 1 ) ;
18
+ } ;
You can’t perform that action at this time.
0 commit comments