File tree 2 files changed +29
-1
lines changed 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
- # 1,879 LeetCode solutions in JavaScript
1
+ # 1,880 LeetCode solutions in JavaScript
2
2
3
3
[ https://leetcodejavascript.com ] ( https://leetcodejavascript.com )
4
4
1759
1759
2312|[ Selling Pieces of Wood] ( ./solutions/2312-selling-pieces-of-wood.js ) |Hard|
1760
1760
2315|[ Count Asterisks] ( ./solutions/2315-count-asterisks.js ) |Easy|
1761
1761
2316|[ Count Unreachable Pairs of Nodes in an Undirected Graph] ( ./solutions/2316-count-unreachable-pairs-of-nodes-in-an-undirected-graph.js ) |Medium|
1762
+ 2317|[ Maximum XOR After Operations] ( ./solutions/2317-maximum-xor-after-operations.js ) |Medium|
1762
1763
2336|[ Smallest Number in Infinite Set] ( ./solutions/2336-smallest-number-in-infinite-set.js ) |Medium|
1763
1764
2338|[ Count the Number of Ideal Arrays] ( ./solutions/2338-count-the-number-of-ideal-arrays.js ) |Hard|
1764
1765
2342|[ Max Sum of a Pair With Equal Sum of Digits] ( ./solutions/2342-max-sum-of-a-pair-with-equal-sum-of-digits.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 2317. Maximum XOR After Operations
3
+ * https://leetcode.com/problems/maximum-xor-after-operations/
4
+ * Difficulty: Medium
5
+ *
6
+ * You are given a 0-indexed integer array nums. In one operation, select any non-negative
7
+ * integer x and an index i, then update nums[i] to be equal to nums[i] AND (nums[i] XOR x).
8
+ *
9
+ * Note that AND is the bitwise AND operation and XOR is the bitwise XOR operation.
10
+ *
11
+ * Return the maximum possible bitwise XOR of all elements of nums after applying the operation
12
+ * any number of times.
13
+ */
14
+
15
+ /**
16
+ * @param {number[] } nums
17
+ * @return {number }
18
+ */
19
+ var maximumXOR = function ( nums ) {
20
+ let maxXor = 0 ;
21
+
22
+ for ( const num of nums ) {
23
+ maxXor |= num ;
24
+ }
25
+
26
+ return maxXor ;
27
+ } ;
You can’t perform that action at this time.
0 commit comments