更新 单调栈系列题目 排版格式修复
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
* -10^9 <= nums[i] <= 10^9
|
||||
|
||||
|
||||
# 思路
|
||||
## 思路
|
||||
|
||||
做本题之前建议先做[739. 每日温度](https://programmercarl.com/0739.每日温度.html) 和 [496.下一个更大元素 I](https://programmercarl.com/0496.下一个更大元素I.html)。
|
||||
|
||||
@@ -138,7 +138,8 @@ public:
|
||||
|
||||
## 其他语言版本
|
||||
|
||||
Java:
|
||||
### Java:
|
||||
|
||||
```Java
|
||||
class Solution {
|
||||
public int[] nextGreaterElements(int[] nums) {
|
||||
@@ -162,7 +163,8 @@ class Solution {
|
||||
}
|
||||
```
|
||||
|
||||
Python:
|
||||
### Python:
|
||||
|
||||
```python
|
||||
# 方法 1:
|
||||
class Solution:
|
||||
@@ -196,7 +198,8 @@ class Solution:
|
||||
stack.append(i)
|
||||
return ans
|
||||
```
|
||||
Go:
|
||||
### Go:
|
||||
|
||||
```go
|
||||
func nextGreaterElements(nums []int) []int {
|
||||
length := len(nums)
|
||||
@@ -218,7 +221,7 @@ func nextGreaterElements(nums []int) []int {
|
||||
}
|
||||
```
|
||||
|
||||
JavaScript:
|
||||
### JavaScript:
|
||||
|
||||
```JS
|
||||
/**
|
||||
@@ -242,7 +245,7 @@ var nextGreaterElements = function (nums) {
|
||||
return res;
|
||||
};
|
||||
```
|
||||
TypeScript:
|
||||
### TypeScript:
|
||||
|
||||
```typescript
|
||||
function nextGreaterElements(nums: number[]): number[] {
|
||||
@@ -266,7 +269,8 @@ function nextGreaterElements(nums: number[]): number[] {
|
||||
};
|
||||
```
|
||||
|
||||
Rust
|
||||
### Rust:
|
||||
|
||||
```rust
|
||||
impl Solution {
|
||||
pub fn next_greater_elements(nums: Vec<i32>) -> Vec<i32> {
|
||||
@@ -290,3 +294,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