Skip to content

Commit 45e2426

Browse files
committedSep 3, 2019
under consideration
1 parent 83d9cbc commit 45e2426

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Position: Software Engineer, Tools and Infrastructure
2+
3+
Given an integer array `nums`. All elements are in range `[1-n]`. Return a new array `counts` where `counts[i]` is the number of larger elements to the left of `nums[i]`.
4+
5+
# Example:
6+
```
7+
Input: [4, 2, 1, 3, 5]
8+
Output: [0, 1, 2, 1, 0]
9+
```
10+
11+
# Follow-up:
12+
Given an array counts, return the original array.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* solution.cpp
3+
* Copyright (C) 2019 Guowei Chen <icgw@outlook.com>
4+
*
5+
* Distributed under terms of the GPL license.
6+
*/
7+
8+
9+
#include <iostream>
10+
#include <vector>
11+
12+
using namespace std;
13+
14+
vector<int> solve(vector<int> nums) {
15+
// TODO:
16+
return { };
17+
}
18+
19+
int main()
20+
{
21+
vector<int> nums { 4, 2, 1, 3, 5 };
22+
vector<int> counts = solve(nums); // { 0, 1, 2, 1, 0 }
23+
return 0;
24+
}

0 commit comments

Comments
 (0)