国内推出北美留学生pre course了# Joke - 肚皮舞运动
g*n
1 楼
You are given two array, first array contain integer which represent heights
of persons and second array contain how many persons in front of him are
standing who are greater than him in term of height and forming a queue. Ex
A: 3 2 1
B: 0 1 1
It means in front of person of height 3 there is no person standing, person
of height 2 there is one person in front of him who has greater height then
he, similar to person of height 1. Your task to arrange them
Ouput should be.
3 1 2
Here, 3 is at front, 1 has 3 in front ,2 has 1 and 3 in front.
另外补充一个例子:
A=5 10 15 4 13 6 3 12
B=0 0 0 1 1 1 2 2
输出是: 5 4 3 10 6 15 13 12
希望能有快过O(n^2)的解法。请大牛们赐教~
of persons and second array contain how many persons in front of him are
standing who are greater than him in term of height and forming a queue. Ex
A: 3 2 1
B: 0 1 1
It means in front of person of height 3 there is no person standing, person
of height 2 there is one person in front of him who has greater height then
he, similar to person of height 1. Your task to arrange them
Ouput should be.
3 1 2
Here, 3 is at front, 1 has 3 in front ,2 has 1 and 3 in front.
另外补充一个例子:
A=5 10 15 4 13 6 3 12
B=0 0 0 1 1 1 2 2
输出是: 5 4 3 10 6 15 13 12
希望能有快过O(n^2)的解法。请大牛们赐教~