PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/TikTok

Determine frog reachability across stones

Last updated: Mar 29, 2026

Quick Overview

This question evaluates dynamic programming, state-space reachability, and constrained transition reasoning, along with skills in hash-based memoization and time/space complexity analysis.

  • Medium
  • TikTok
  • Coding & Algorithms
  • Machine Learning Engineer

Determine frog reachability across stones

Company: TikTok

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

You are given a sorted array of distinct integers stones representing stone positions in a river, where stones[0] = 0. A frog starts on stone 0; its first jump must be 1 unit. If its last jump was k units, the next jump must be k−1, k, or k+1 units (and must be > 0). Determine whether the frog can reach the last stone. Design and justify an efficient algorithm (e.g., DP with hash sets or maps), including correctness arguments and time/space complexity. Follow-ups: discuss pruning strategies and worst-case inputs.

Quick Answer: This question evaluates dynamic programming, state-space reachability, and constrained transition reasoning, along with skills in hash-based memoization and time/space complexity analysis.

Related Interview Questions

  • Parse a nested list from a string - TikTok (medium)
  • Implement stacks, streaming median, and upward path sum - TikTok (easy)
  • Solve common string/DP/stack problems - TikTok (medium)
  • Implement stack variants and path-sum check - TikTok (medium)
  • Maximize sum with no adjacent elements - TikTok (medium)
TikTok logo
TikTok
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
3
0

You are given a sorted array of distinct integers stones representing stone positions in a river, where stones[0] = 0. A frog starts on stone 0; its first jump must be 1 unit. If its last jump was k units, the next jump must be k−1, k, or k+1 units (and must be > 0). Determine whether the frog can reach the last stone. Design and justify an efficient algorithm (e.g., DP with hash sets or maps), including correctness arguments and time/space complexity. Follow-ups: discuss pruning strategies and worst-case inputs.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More TikTok•More Machine Learning Engineer•TikTok Machine Learning Engineer•TikTok Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.