当前位置:网站首页>Greedy two-dimensional array sorting
Greedy two-dimensional array sorting
2022-06-30 14:37:00 【Douglas_ LT】
A daily topic ing, Today is a day medium topic 406. Rebuild the queue according to height
class Solution {
public:
static bool cmp(const vector<int> a, const vector<int> b) {
if (a[0] == b[0]) return a[1] < b[1];
return a[0] > b[0];
}
vector<vector<int>> reconstructQueue(vector<vector<int>>& people) {
sort (people.begin(), people.end(), cmp);
vector<vector<int>> que;
for (int i = 0; i < people.size(); i++) {
int position = people[i][1];
que.insert(que.begin() + position, people[i]);
}
return que;
}
};
边栏推荐
- Introduction to the construction and development of composer private warehouse
- Advanced usage of go language for loop break and continue
- Why does the folder appear open in another program
- Detailed explanation of the first three passes of upload Labs
- JS to realize simple lottery function
- Go sync. WaitGroup
- Pit used by go language array type
- Problem: wechat developer tool visitor mode cannot use this function
- PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
- Details of gets, fgetc, fgets, Getc, getchar, putc, fputc, putchar, puts, fputs functions
猜你喜欢

Using docker to manage MySQL services under Windows

Laravel configures passport and returns token using JWT
![[buuctf] [geek challenge 2019] secret file](/img/00/23bebd013eb4035555c0057725e3c4.jpg)
[buuctf] [geek challenge 2019] secret file

JS to realize simple lottery function

Detailed explanation of the first three passes of upload Labs

@PathVariable

About the problems encountered when using the timer class to stop with a button (why does the QPushButton (for the first time) need to be clicked twice to respond?)

After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs

Fastcgi CGI shallow understanding

Realize a simple LAN communication (similar to feiqiu)
随机推荐
Use of laravel repository mode
Using docker to manage MySQL services under Windows
Go language mutex lock
数据恢复软件EasyRecovery15下载
Introduction to the construction and development of composer private warehouse
Initial attack and defense world Misc
PHP generate images into Base64
@Role of ResponseBody
PHP excel export function encapsulation (based on phpexcel class)
The JSON data returned from the control layer to JS has a "\" translator. How to remove it
Go common lock mutex and rwmutex
[buuctf] [geek challenge 2019] secret file
V3 01_ Welcome
Details of gets, fgetc, fgets, Getc, getchar, putc, fputc, putchar, puts, fputs functions
Wechat applet realizes map navigation + door-to-door recycling
About the problems encountered when using the timer class to stop with a button (why does the QPushButton (for the first time) need to be clicked twice to respond?)
@Component use cases
How to realize selective screen recording for EV screen recording
Upgrade composer self update
Thinkphp5 log file contains trick