FastPrepFrog Jump
Problems/Frog Jump

Frog Jump

Zillow logoZillow● HardINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported at Zillow by a candidate for a Software Engineer internship in the United States who interviewed in January 2021, rated the experience negative and did not get an offer. The first interviewer asked a system design question. A second interviewer then gave two hard coding questions within 30 minutes; the candidate solved the first with difficulty, did not solve the second, and says the interviewer gave no help. The report's question list names the well-known Frog Jump task.

The report does not say which of the two coding questions was Frog Jump; we read it as one of them. Neither interview is described as a phone screen, a final round or an onsite, so we list it under phone screens, our default when the kind of round is not given.

We use the usual form of the named task: the frog starts on the stone at position 0, its first jump covers 1 unit, and after a jump of k units the next one covers k - 1, k or k + 1 units, always forward and always onto a stone. Our choices: the function canCross gets the stone positions as a sorted array and returns whether the frog can reach the last stone; the limits (2 to 2,000 stones, positions from 0 to 2^31 - 1) are ours as well. The report calls both coding questions hard, and we rate it hard.

Our version is about 90% the same as the reported question.

A frog wants to cross a river by hopping from stone to stone. You are given an integer array stones with the positions of the stones, in units from the near bank, sorted in strictly increasing order. stones[0] is always 0, and the frog starts on that stone.

The frog only jumps forward and must land on a stone, never in the water. Its first jump covers exactly 1 unit. If its last jump covered k units, its next jump must cover k - 1, k or k + 1 units, and every jump covers at least 1 unit.

Return true if the frog can reach the last stone, or false if it cannot.

Function

canCross(stones: int[]) → boolean

Examples

Example 1

stones = [0,1,2,3,5]return = true

The first jump goes from 0 to 1. One way across: jump 1 unit to 2, then 1 unit to 3, then 2 units to 5. The jumps cover 1, 1, 1 and 2 units, and each one differs from the jump before it by at most 1.

Example 2

stones = [0,1,3,4,7]return = false

The frog must go 0 to 1 to 3, with jumps of 1 and 2 units. From 3 it can jump 1, 2 or 3 units, and only the 1-unit jump lands on a stone, at 4. From 4 the next jump covers 1 or 2 units, so it can reach 5 or 6, and neither is a stone. The stone at 7 is never reached.

Example 3

stones = [0,2]return = false

The first jump must cover exactly 1 unit, which lands in the water at position 1.

Constraints

  • 2 <= stones.length <= 2000
  • 0 <= stones[i] <= 231 - 1
  • stones[0] == 0
  • stones is sorted in strictly increasing order.

More Zillow Phone Screen questions

  • Valid ParenthesesPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2025
  • Time Based Key-Value StorePHONE SCREEN · Seen Feb 2024
  • Filter Formatted Records by CriteriaPHONE SCREEN · Seen Sep 2023
  • Build a Hash TablePHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2023
  • Jump GamePHONE SCREEN · Seen Dec 2022
  • Reversible Run-Length EncodingPHONE SCREEN · Seen Nov 2022
  • Spiral MatrixPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2022
  • Two Sum: All PairsPHONE SCREEN · Seen Nov 2022
  • Employee Free TimePHONE SCREEN · Seen Oct 2022
  • First Unique Character in a StringPHONE SCREEN · Seen Oct 2022

Similar questions at other companies

  • Word Break IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Count Ordered Combination Sums with Negative ValuesPinterest · PHONE SCREENPinterest interview questions
  • Word Break IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Predicate Expression Tree EvaluatorMongoDB · PHONE SCREENMongoDB interview questions
  • Find Max Length of SubsequenceGoogle · PHONE SCREENGoogle interview questions
  • Longest Fibonacci-Like SubsequenceAdobe · PHONE SCREENAdobe interview questions
  • Longest Common Contiguous Browser HistoryRoblox · PHONE SCREENRoblox interview questions
  • Longest Common URL History RunDatadog · PHONE SCREENDatadog interview questions
  • Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
  • Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
All Zillow interview questionsSee Zillow hiring insights
Saved
class Solution {
    public boolean canCross(int[] stones) {
        // Write your code here.
    }
}
Checking account…