Devi prendere due liste di numeri interi positivi come input, chiamiamoli n e m .
Puoi presumere che:
- Tutti i numeri interi in n fanno parte di m
- Tutti i numeri interi in m sono unici
- Gli elenchi non sono vuoti
Sfida: restituisce gli indici di dove trovi i valori in n , in m .
Potrebbe essere fonte di confusione, ma penso che i casi di test renderanno il compito abbastanza chiaro. Gli esempi sono 1-indicizzati, puoi scegliere 0-indicizzati se vuoi (per favore specifica).
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
I vincitori saranno le soluzioni più brevi in ogni lingua.
Questo è un bel post-post comunque!