Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
leetcode: finished #2717
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Jul 25, 2023
1 parent 9df7077 commit 8377767
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions content/leetcode/2023/7.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ title: "2023.7"
draft: false
---

# 2023.7.25

```python
#
# @lc app=leetcode.cn id=2717 lang=python3
#
# [2717] 半有序排列
#

# @lc code=start
from typing import List


class Solution:
def semiOrderedPermutation(self, nums: List[int]) -> int:
a = nums.index(1)
b = list(reversed(nums)).index(len(nums))
c = 0
if (a - nums.index(len(nums))) > 0:
c = 1
return a + b - c


# @lc code=end
```

# 2023.7.24

```python
Expand Down

0 comments on commit 8377767

Please sign in to comment.