You must take two lists of positive integers as input, let's call these n and m.
You may assume that:
- All integers in n are part of m
- All integers in m are unique
- The lists are non-empty
Challenge: Return the indices of where you find the values in n, in m.
That might be confusing, but I think the test cases will make the task pretty clear. The examples are 1-indexed, you may choose 0-indexed if you want to (please specify).
n = 5 3 4 1
m = 6 8 4 1 2 5 3 100
output: 6 7 3 4 // 5 is in the 6th position of m
// 3 is in the 7th position of m
// 4 is in the 3rd position of m
// 1 is in the 4th position of m
n = 5 3 4 9 7 5 7
m = 3 4 5 7 9
output: 3 1 2 5 4 3 4
n = 1 2 3 4 5 6
m = 1 2 3 4 5 6
output: 1 2 3 4 5 6
n = 16 27 18 12 6 26 11 24 26 20 2 8 7 12 5 22 22 2 17 4
m = 15 18 11 16 14 20 37 38 6 36 8 32 21 2 31 22 33 4 1 35 3 25 9 30 26 39 5 23 29 10 13 12 7 19 24 17 34 27 40 28
output: 4 38 2 32 9 25 3 35 25 6 14 11 33 32 27 16 16 14 36 18
n = 54
m = 54
output: 1
The winners will be the shortest solutions in each language.
This is a very nice meta-post by the way!