akshitagit / akshitagit/CPP

Minimum Steps in Infinite grid

Ouverte
#193 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
algorithms BEGINNER C CPP good first issue hacktoberfest Hacktoberfest2020
Langage dominant
C++
Étoiles
504
Forks
436
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

You are in an infinite 2D grid where you can move in any of the 8 directions
(x,y) to
(x+1, y) ,
(x - 1, y) ,
(x, y+1) ,
(x, y-1) ,
(x-1, y-1) ,
(x+1,y+1) ,
(x-1,y+1) ,
(x+1,y-1)
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 Format-
Given two integer arrays A and B, where A[i] is x coordinate and B[i] is y coordinate of ith point respectively.
Output Format-
Return an Integer, i.e minimum number of steps.

sample i/p o/p
input:
A = [0, 1, 1]
B = [0, 1, 2]
Output:
2

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.