Skip to content

Commit b25a46f

Browse files
committed
Added README.md file for Split the Array
1 parent 1df3f89 commit b25a46f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

3324-split-the-array/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2><a href="https://leetcode.com/problems/split-the-array">Split the Array</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>You are given an integer array <code>nums</code> of <strong>even</strong> length. You have to split the array into two parts <code>nums1</code> and <code>nums2</code> such that:</p>
2+
3+
<ul>
4+
<li><code>nums1.length == nums2.length == nums.length / 2</code>.</li>
5+
<li><code>nums1</code> should contain <strong>distinct </strong>elements.</li>
6+
<li><code>nums2</code> should also contain <strong>distinct</strong> elements.</li>
7+
</ul>
8+
9+
<p>Return <code>true</code><em> if it is possible to split the array, and </em><code>false</code> <em>otherwise</em><em>.</em></p>
10+
11+
<p>&nbsp;</p>
12+
<p><strong class="example">Example 1:</strong></p>
13+
14+
<pre>
15+
<strong>Input:</strong> nums = [1,1,2,2,3,4]
16+
<strong>Output:</strong> true
17+
<strong>Explanation:</strong> One of the possible ways to split nums is nums1 = [1,2,3] and nums2 = [1,2,4].
18+
</pre>
19+
20+
<p><strong class="example">Example 2:</strong></p>
21+
22+
<pre>
23+
<strong>Input:</strong> nums = [1,1,1,1]
24+
<strong>Output:</strong> false
25+
<strong>Explanation:</strong> The only possible way to split nums is nums1 = [1,1] and nums2 = [1,1]. Both nums1 and nums2 do not contain distinct elements. Therefore, we return false.
26+
</pre>
27+
28+
<p>&nbsp;</p>
29+
<p><strong>Constraints:</strong></p>
30+
31+
<ul>
32+
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
33+
<li><code>nums.length % 2 == 0 </code></li>
34+
<li><code>1 &lt;= nums[i] &lt;= 100</code></li>
35+
</ul>

0 commit comments

Comments
 (0)