-
Notifications
You must be signed in to change notification settings - Fork 130
Add: new #758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Add: new #758
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
problems/convert-integer-to-the-sum-of-two-no-zero-integers/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!--|This file generated by command(leetcode description); DO NOT EDIT. |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
<!--|@author openset <openset.wang@gmail.com> |--> | ||
<!--|@link https://github.com/openset |--> | ||
<!--|@home https://github.com/openset/leetcode |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
|
||
[< Previous](../distinct-echo-substrings "Distinct Echo Substrings") | ||
|
||
[Next >](../minimum-flips-to-make-a-or-b-equal-to-c "Minimum Flips to Make a OR b Equal to c") | ||
|
||
## [1317. Convert Integer to the Sum of Two No-Zero Integers (Easy)](https://leetcode.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers "将整数转换为两个无零整数的和") | ||
|
||
<p>Given an integer <code>n</code>. No-Zero integer is a positive integer which <strong>doesn't contain any 0</strong> in its decimal representation.</p> | ||
|
||
<p>Return <em>a list of two integers</em> <code>[A, B]</code> where:</p> | ||
|
||
<ul> | ||
<li><code>A</code> and <code>B</code> are No-Zero integers.</li> | ||
<li><code>A + B = n</code></li> | ||
</ul> | ||
|
||
<p>It's guarateed that there is at least one valid solution. If there are many valid solutions you can return any of them.</p> | ||
|
||
<p> </p> | ||
<p><strong>Example 1:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> n = 2 | ||
<strong>Output:</strong> [1,1] | ||
<strong>Explanation:</strong> A = 1, B = 1. A + B = n and both A and B don't contain any 0 in their decimal representation. | ||
</pre> | ||
|
||
<p><strong>Example 2:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> n = 11 | ||
<strong>Output:</strong> [2,9] | ||
</pre> | ||
|
||
<p><strong>Example 3:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> n = 10000 | ||
<strong>Output:</strong> [1,9999] | ||
</pre> | ||
|
||
<p><strong>Example 4:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> n = 69 | ||
<strong>Output:</strong> [1,68] | ||
</pre> | ||
|
||
<p><strong>Example 5:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> n = 1010 | ||
<strong>Output:</strong> [11,999] | ||
</pre> | ||
|
||
<p> </p> | ||
<p><strong>Constraints:</strong></p> | ||
|
||
<ul> | ||
<li><code>2 <= n <= 10^4</code></li> | ||
</ul> | ||
|
||
### Related Topics | ||
[[Math](../../tag/math/README.md)] | ||
|
||
### Hints | ||
<details> | ||
<summary>Hint 1</summary> | ||
Loop through all elements from 1 to n. | ||
</details> | ||
|
||
<details> | ||
<summary>Hint 2</summary> | ||
Choose A = i and B = n - i then check if A and B are both No-Zero integers. | ||
</details> |
41 changes: 41 additions & 0 deletions
problems/decompress-run-length-encoded-list/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!--|This file generated by command(leetcode description); DO NOT EDIT. |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
<!--|@author openset <openset.wang@gmail.com> |--> | ||
<!--|@link https://github.com/openset |--> | ||
<!--|@home https://github.com/openset/leetcode |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
|
||
[< Previous](../minimum-insertion-steps-to-make-a-string-palindrome "Minimum Insertion Steps to Make a String Palindrome") | ||
|
||
[Next >](../matrix-block-sum "Matrix Block Sum") | ||
|
||
## [1313. Decompress Run-Length Encoded List (Easy)](https://leetcode.com/problems/decompress-run-length-encoded-list "解压缩编码列表") | ||
|
||
<p>We are given a list <code>nums</code> of integers representing a list compressed with run-length encoding.</p> | ||
|
||
<p>Consider each adjacent pair of elements <code>[a, b] = [nums[2*i], nums[2*i+1]]</code> (with <code>i >= 0</code>). For each such pair, there are <code>a</code> elements with value <code>b</code> in the decompressed list.</p> | ||
|
||
<p>Return the decompressed list.</p> | ||
|
||
<p> </p> | ||
<p><strong>Example 1:</strong></p> | ||
<pre><strong>Input:</strong> nums = [1,2,3,4] | ||
<strong>Output:</strong> [2,4,4,4] | ||
</pre> | ||
<p> </p> | ||
<p><strong>Constraints:</strong></p> | ||
|
||
<ul> | ||
<li><code>2 <= nums.length <= 100</code></li> | ||
<li><code>nums.length % 2 == 0</code></li> | ||
<li><code><font face="monospace">1 <= nums[i] <= 100</font></code></li> | ||
</ul> | ||
|
||
### Related Topics | ||
[[Array](../../tag/array/README.md)] | ||
|
||
### Hints | ||
<details> | ||
<summary>Hint 1</summary> | ||
Decompress the given array by repeating nums[2*i+1] a number of times equal to nums[2*i]. | ||
</details> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.