Merge branch 'master' into remote

This commit is contained in:
程序员Carl
2022-05-12 09:21:30 +08:00
committed by GitHub
78 changed files with 1101 additions and 2764 deletions

View File

@@ -290,6 +290,7 @@ var reconstructQueue = function(people) {
};
```
### C
```c
int cmp(const void *p1, const void *p2) {
@@ -337,6 +338,25 @@ int** reconstructQueue(int** people, int peopleSize, int* peopleColSize, int* re
}
```
### TypeScript
```typescript
function reconstructQueue(people: number[][]): number[][] {
people.sort((a, b) => {
if (a[0] === b[0]) return a[1] - b[1];
return b[0] - a[0];
});
const resArr: number[][] = [];
for (let i = 0, length = people.length; i < length; i++) {
resArr.splice(people[i][1], 0, people[i]);
}
return resArr;
};
```
-----------------------
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>