forked from doocs/leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add weekly contest 418 (doocs#3603)
- Loading branch information
Showing
46 changed files
with
986 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
96 changes: 96 additions & 0 deletions
96
solution/3300-3399/3309.Maximum Possible Number by Binary Concatenation/README.md
This file contains 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,96 @@ | ||
--- | ||
comments: true | ||
difficulty: 中等 | ||
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3309.Maximum%20Possible%20Number%20by%20Binary%20Concatenation/README.md | ||
--- | ||
|
||
<!-- problem:start --> | ||
|
||
# [3309. 连接二进制表示可形成的最大数值](https://leetcode.cn/problems/maximum-possible-number-by-binary-concatenation) | ||
|
||
[English Version](/solution/3300-3399/3309.Maximum%20Possible%20Number%20by%20Binary%20Concatenation/README_EN.md) | ||
|
||
## 题目描述 | ||
|
||
<!-- description:start --> | ||
|
||
<p>给你一个长度为 <code>3</code> 的整数数组 <code>nums</code>。</p> | ||
|
||
<p>现以某种顺序<strong> 连接 </strong>数组 <code>nums</code> 中所有元素的 <strong>二进制表示</strong> ,请你返回可以由这种方法形成的 <strong>最大 </strong>数值。</p> | ||
|
||
<p><strong>注意</strong> 任何数字的二进制表示<em> </em><strong>不含</strong><em> </em>前导零。</p> | ||
|
||
<p> </p> | ||
|
||
<p><strong class="example">示例 1:</strong></p> | ||
|
||
<div class="example-block"> | ||
<p><strong>输入:</strong> <span class="example-io">nums = [1,2,3]</span></p> | ||
|
||
<p><strong>输出:</strong> 30</p> | ||
|
||
<p><strong>解释:</strong></p> | ||
|
||
<p>按照顺序 <code>[3, 1, 2]</code> 连接数字的二进制表示,得到结果 <code>"11110"</code>,这是 30 的二进制表示。</p> | ||
</div> | ||
|
||
<p><strong class="example">示例 2:</strong></p> | ||
|
||
<div class="example-block"> | ||
<p><strong>输入:</strong> <span class="example-io">nums = [2,8,16]</span></p> | ||
|
||
<p><strong>输出:</strong> 1296</p> | ||
|
||
<p><strong>解释:</strong></p> | ||
|
||
<p>按照顺序 <code>[2, 8, 16]</code> 连接数字的二进制表述,得到结果 <code>"10100010000"</code>,这是 1296 的二进制表示。</p> | ||
</div> | ||
|
||
<p> </p> | ||
|
||
<p><strong>提示:</strong></p> | ||
|
||
<ul> | ||
<li><code>nums.length == 3</code></li> | ||
<li><code>1 <= nums[i] <= 127</code></li> | ||
</ul> | ||
|
||
<!-- description:end --> | ||
|
||
## 解法 | ||
|
||
<!-- solution:start --> | ||
|
||
### 方法一 | ||
|
||
<!-- tabs:start --> | ||
|
||
#### Python3 | ||
|
||
```python | ||
|
||
``` | ||
|
||
#### Java | ||
|
||
```java | ||
|
||
``` | ||
|
||
#### C++ | ||
|
||
```cpp | ||
|
||
``` | ||
|
||
#### Go | ||
|
||
```go | ||
|
||
``` | ||
|
||
<!-- tabs:end --> | ||
|
||
<!-- solution:end --> | ||
|
||
<!-- problem:end --> |
Oops, something went wrong.