Code Monkey home page Code Monkey logo

blob's Introduction

Blob

=======================

Bridgewater coding challenge #2

A Blob is a shape in two-dimensional integer coordinate space where all cells have at least one adjoining cell to the right, left, top, or bottom that is also occupied. Given a 10x10 array of boolean values that represents a Blob uniformly selected at random from the set of all possible Blobs that could occupy that array, write a program that will determine the Blob boundaries. Optimize first for finding the correct result, second for performing a minimum number of cell Boolean value reads, and third for the elegance and clarity of the solution.

How to get the code:

$ git clone https://github.com/gabe0912/Blob.git
$ cd Blob

How to run the program:

$ java -jar out/artifacts/blob_jar/blob.jar inputBlob.txt

How to see the source code:

https://github.com/gabe0912/Blob/tree/master/src/main/java

Main-Class: BlobBoundary.java

Clarifications/Assumptions:

  1. Blobs are a significant percentage of the entire matrix, so walking the edge should be efficient enough
  2. We start "walking" clockwise from the origin

Limitations:

  1. Could be more optimal by assuming blobs are always connected - this would lower the number of cells read
  2. Could potentially also save reads by iterating counter-clockwise once initial position is found since we already know elements on the left, top, and top-left positions must be clear

blob's People

Contributors

gabe0912 avatar

Watchers

James Cloos 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.