DEV Community

Cover image for [Devmates.co] Jumps with Boost by 🏢Microsoft
Alex Wawl 🐼
Alex Wawl 🐼

Posted on

1 1

[Devmates.co] Jumps with Boost by 🏢Microsoft

Hello👋,
My name is Alex and I'm maker of Devmates.co. 😊

We are resolving daily coding problems which asked by top tech companies together. We share our solutions, give some help if anyone stuck, support each other and just hangout together in the internet. 🍻☕️💬

I get this problem from our members or just searching them in the internet(leetcode forums, Glassdoor, teamblind, etc.). Sometimes this problem can be very easy, sometimes too 👷‍♂️hard, everything depends on skills but we are trying to resolve all of them and Have Fun. 🙌

Today I want to share problem which was asked by 🏢Microsoft.

Problem:

Given an array containing numbers 1 to n where array[i] = i+1.

Find the minimum number of jumps required from arr[0] to arr[n-1].

  • From current position i, we can jump to positions i+1, i+2, i+3 and I+4

  • There are optional boosters given in the form of an object like - {1: 15, 5: 10} which means, if we reached at index 1 we can directly jump to index 15 similarly, if we reached at index 5, we can directly jump to index 10.

Example:

Input:
arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
boosters = {3: 8, 5:10}
Output: 4
Why: (1 -> 5 -> 10 -> 14 -> 15)

Link to the Problem

🙌 Don't hesitate to share your solutions directly on devmates.co

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay