Jumping stones
Practice
2.9 (30 votes)
Algorithms
Dynamic programming
Problem
88% Success 8316 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
There are \(n\) stones in a row from left to right. You are standing on the first stone. From every stepĀ from stone number \(i\), you can jump at most \(k\) stones further (\(i + 1,\ i + 2,\ \dots,\ i + k\)). You cannot jump over stone number \(n\). How many ways are there to travel to stone number \(n\)?
Input format
First line: \(n\) and \(k\)
Output format
Print the answer modulo \(10^9+7\).
Explanation
-
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
9 votes
Tags:
Real worldIntroduction to Dynamic Programming 1AlgorithmsDynamic Programming
Points:20
38 votes
Tags:
Ad-HocApprovedDynamic ProgrammingEasyOpen
Points:20
281 votes
Tags:
ApprovedEasyHash MapsHash TablesHiringReadySortingTrees
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output