Given an array of positive numbers, where each element represents the max number of jumps that can be made forward from that element, write a program to find the minimum number of jumps needed to reach the end of the array (starting from the first element). If an element is 0, then we cannot move through that element.

package practice;

public class ArrayJump {

public int countMinJumps(int[] jumps) {

if (jumps == null || jumps.length < 2) {
return 0;
}
int[] minJumps = new int[jumps.length];
minJumps[0] = 0;

Reference Video: https://www.youtube.com/watch?v=cETfFsSTGJI

--

--

--

Principal Software Engineer , Mobile Engineering

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Building a Domain-Specific Language with Chrevrotain

How to Check Multiple Text Inputs for SQL Injection Attacks in Python

Hello Docker — Part 1

Encode x ATX DAO Austin Hackathon: Announcing Phala Network

Load Balancers and How To Install Nginx Load Balancer to Django Project on Windows

The easiest way to update Jenkins — boobo94

Determining file format using Python

Generate Stripe Payment Links in Bulk

Stripe Payment Links generator

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amit Gupta

Amit Gupta

Principal Software Engineer , Mobile Engineering

More from Medium

leetcode 1481. Least Number of Unique Integers after K Removals

Cloning AJIO!

Minecraft Starter vs. Master Collection - a Short Guide

Journey of DLithe Bootcamp .NET Full Stack Developer | Week 4 (Feb14-Feb19)