Giter Site home page Giter Site logo

closestlocker's Introduction

Amazon is currently underway putting Amazon Lockers across the country. The 
Locker team wants to ensure that lockers are placed so that customers in the 
city are always within a short distance from an Amazon Locker. To account for 
this they need a wat to model locker placements and distances from lockers.

For this task you are provided:
1. A positive whole number range 1-9 representing the length of your city in city blocks.
2. A positive whole number range 1-9 representing the width of your city in city blocks
3. An array containing all X coordinates representing Amazon Locker locations, each X coordinate range 1-9
4. An array containing all Y coordinates representing Amazon Locker locations, each Y coordinate range 1-9

Your job is to construct 2-d grid of the city. Each elemnt of the grid should be
a positive whole number that specifies the number of blocks to the closest locker.
The distance between the two blocks is the sum of their horizontal and vertical
distance (a move in the diagonal direction is therefore considered a distance 
of 2). Return your grid as 2D array of integers where the first index corresponds 
to the X dimension and the second index corresponds to the Y direction.

Example # 1:
Given
1. 3
2. 5
3. [1]
4. [1]

Return
012
123
234
345
456

Example # 2:
Given
1. 5
2. 7
3. [2,4]
4. [3,7]

Return
32345
21234
10123
21234
32323
43212
32101

closestlocker's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.