注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
- A robot responds to two commands, i or R, that tells it to move one step t the left ( i ) or one step to the right (R) on a horizontal line.
You're given a string commands representing a series of i and R commands. After responding to all the commands in order, the robot will stop.
Your task is to determine whether it will stop to the left or the right of its starting position:- If the robot will stop to the left of its starting position, return "I"
- If the robot will stop at its starting position, return an empty string.
- If the robot will stop to the right of its starting position, return "R"
2.Siven a string of space-separated numbers sensorReadings , identif umber with at least two conlution (latencies, threshold) = 3 •
and threshold = 4, the output
Explanation:
The longest contiguous subarray that satisfies the condition is 19, 6, 81, where the difference between the maximum 9 and minimum 6 is
3, which is less than the threshold.- For latencies = [1] and threshold = 10, the output should be
solution (latencies, threshold) = 1.
Explanation:
The array contains only one element, so the longest contiguous subarray is the array itself.
|