mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2026-02-02 18:39:09 +08:00
更新 单调栈系列题目 排版格式修复
This commit is contained in:
@@ -37,7 +37,7 @@ nums1 中数字 x 的下一个更大元素是指 x 在 nums2 中对应位
|
||||
* nums1和nums2中所有整数 互不相同
|
||||
* nums1 中的所有整数同样出现在 nums2 中
|
||||
|
||||
# 思路
|
||||
## 思路
|
||||
|
||||
做本题之前,建议先做一下[739. 每日温度](https://programmercarl.com/0739.每日温度.html)
|
||||
|
||||
@@ -191,7 +191,8 @@ public:
|
||||
建议大家把情况一二三想清楚了,先写出版本一的代码,然后在其基础上在做精简!
|
||||
|
||||
## 其他语言版本
|
||||
Java
|
||||
### Java
|
||||
|
||||
```java
|
||||
class Solution {
|
||||
public int[] nextGreaterElement(int[] nums1, int[] nums2) {
|
||||
@@ -248,7 +249,8 @@ class Solution {
|
||||
}
|
||||
}
|
||||
```
|
||||
Python3:
|
||||
### Python3
|
||||
|
||||
```python
|
||||
class Solution:
|
||||
def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]:
|
||||
@@ -269,7 +271,7 @@ class Solution:
|
||||
return result
|
||||
```
|
||||
|
||||
Go:
|
||||
### Go
|
||||
|
||||
> 未精简版本
|
||||
```go
|
||||
@@ -335,7 +337,7 @@ func nextGreaterElement(nums1 []int, nums2 []int) []int {
|
||||
}
|
||||
```
|
||||
|
||||
JavaScript:
|
||||
### JavaScript
|
||||
|
||||
```JS
|
||||
var nextGreaterElement = function (nums1, nums2) {
|
||||
@@ -358,7 +360,7 @@ var nextGreaterElement = function (nums1, nums2) {
|
||||
};
|
||||
```
|
||||
|
||||
TypeScript:
|
||||
### TypeScript
|
||||
|
||||
```typescript
|
||||
function nextGreaterElement(nums1: number[], nums2: number[]): number[] {
|
||||
@@ -387,7 +389,7 @@ function nextGreaterElement(nums1: number[], nums2: number[]): number[] {
|
||||
};
|
||||
```
|
||||
|
||||
Rust
|
||||
### Rust
|
||||
|
||||
```rust
|
||||
impl Solution {
|
||||
@@ -419,3 +421,4 @@ impl Solution {
|
||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||
</a>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user