Minimum Steps in Infinite Grid.
This programming question is often asked in many It Giants Interview questions and competitive programming Questions. Often Google and Amazon asked in their Software Engineering interview.
The same programming question you can also find on the InterviewBit: Coding Interview Question.
In this post, we are going to solve the problem in Java. You can also solve the Minimum steps to reach the destination in your choice of programming language.
You might like this also: Find Duplicate In Array (Java)- InterviewBit Problem Solution
Problem Statement of Minimum Steps in Infinite Grid Competitive Programming Question
You are in an infinite 2D grid where you can move in any of the 8 directions:
(x – 1, y),
You are given a sequence of points and the order in which you need to cover the points. Give the minimum number of steps in which you can achieve it. You start from the first point.
Input : [(0, 0), (1, 1), (1, 2)]
It takes 1 step to move from (0, 0) to (1, 1). It takes one more step to move from (1, 1) to (1, 2).
Java Source Code of Minimum Steps in Infinite Grid
You can also get more competition programming question solution on here.
You can also get latest coding problems and many more code snippets directly to your Email by subscribing our newsletters.
You Might Like This