תיאור השאלה
Given an array representing stones' positions, determine the minimal maximum jump for the frog to reach the end.
איך פותרים?
The optimal route skips every other stone, so the answer is the maximum gap between stones two positions apart (with the first jump handled separately).
פתרון קוד
JavaScript
Python
function maxJump(stones) {
let answer = stones[1] - stones[0];
for (let i = 2; i < stones.length; i++) {
answer = Math.max(answer, stones[i] - stones[i - 2]);
}
return answer;
}הסבר וידאו כיצד לפתור את השאלה

לעבור את ראיון העבודה הבא שלך בהצלחה
קורס דיגיטלי מקיף עם +25 שיעורים מעשיים, כשעתיים של וידאו, וליווי של מראיין בכיר.