بر اساس نمونه ورودی و خروجی زیر، الگوی مربوطه را یافته و تابعی بنویسید که تمام ورودی خروجی های زیر در آن صدق کند.
نمونه ورودی و خروجی
RunningAthlete(["run", "jump", "run", "jump", "run"], "_|_|_") ➞ _|_|_
RunningAthlete(["run", "jump", "run", "run", "run"], "_|_|_") ➞ _|_/_
RunningAthlete(["jump", "jump", "jump", "jump", "jump"], "_|_|_") ➞ x|x|x
EXPECT_EQ(RunningAthlete({"run", "jump", "run", "jump", "run"}, "_|_|_"), "_|_|_"); EXPECT_EQ(RunningAthlete({"run", "jump", "run", "run", "run"}, "_|_|_"), "_|_/"); EXPECT_EQ(RunningAthlete({"jump", "jump", "jump", "jump", "jump"}, "_|_|_"), "x|x|x"); EXPECT_EQ(RunningAthlete({"run", "run", "run", "run", "run"}, "_|_|_"), "_/_/_");
نظرات