mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>You are given an array <code>nums</code> consisting of <strong>positive</strong> integers.</p>
 | 
						|
 | 
						|
<p>You have to take each integer in the array, <strong>reverse its digits</strong>, and add it to the end of the array. You should apply this operation to the original integers in <code>nums</code>.</p>
 | 
						|
 | 
						|
<p>Return <em>the number of <strong>distinct</strong> integers in the final array</em>.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> nums = [1,13,10,12,31]
 | 
						|
<strong>Output:</strong> 6
 | 
						|
<strong>Explanation:</strong> After including the reverse of each number, the resulting array is [1,13,10,12,31,<u>1,31,1,21,13</u>].
 | 
						|
The reversed integers that were added to the end of the array are underlined. Note that for the integer 10, after reversing it, it becomes 01 which is just 1.
 | 
						|
The number of distinct integers in this array is 6 (The numbers 1, 10, 12, 13, 21, and 31).</pre>
 | 
						|
 | 
						|
<p><strong class="example">Example 2:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> nums = [2,2,2]
 | 
						|
<strong>Output:</strong> 1
 | 
						|
<strong>Explanation:</strong> After including the reverse of each number, the resulting array is [2,2,2,<u>2,2,2</u>].
 | 
						|
The number of distinct integers in this array is 1 (The number 2).
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</strong></p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
 | 
						|
	<li><code>1 <= nums[i] <= 10<sup>6</sup></code></li>
 | 
						|
</ul>
 |