← 返回 meta 的题目列表Calculate Speeds of Animals Using Two Datasets
类型:online_judge
Given two datasets, dataset1 and dataset2, implement a function to return a list of speeds of animals that walk on two legs, printed in descending order.
The datasets are formatted as:
dataset1: contains fields name, leg
dataset2: contains fields name, tail, number of legs used for walking
Assume the speed calculation formula involves leg and tail. The datasets may have intersections on the name field. Combine the data from both datasets to compute each animal's speed as needed.
Example
Input
[{name: 'animal1', leg: 4}, {name: 'animal2', leg: 2}], [{name: 'animal2', tail: 3, legs: 2}, {name: 'animal3', tail: 1, legs: 4}]