Pather Problem

<a href="http://pixabay.com/en/forest-path-wood-fern-249029/" target="_blank">Pixbay: kitti851</a>

Several weeks ago I was asked to complete a programming challenge for a potential job. The job was for a web development company where I would be doing a combination of back-end PHP development and front-end GUI work with HTML, CSS and JavaScript. So it was a bit of a surprise that the programming challenge had nothing to do with web development. Rather it was an algorithm problem and one that I didn't feel was all that challenging. Of course, after submitting the work, I was told they were going to look at other people for the position. So there’s the possibility that I missed some corner case in my solution. Anyhow, I figured I shouldn't let that hour or two of thinking and programming go to waste.

So I've posted my solution and its associated files on my GitHub account.

In this challenge, the input is a square grid with some number of hash marks (#). The goal is to connect the hash marks with splats (*). The instructions stated that no diagonal lines were allowed and, when a choice is available, a line must be drawn vertically before horizontally. A couple examples are shown below:

FROM:
....
#..#
....
TO:
....
#**#
....
FROM:
.#...
.....
...#.
TO:
.#...
.*...
.**#.

If you are interested in my solution to the problem, you can visit the code on my GitHub page. If you see any glaring errors, I’d love to hear them.

Comments

2

Hi there just wanted to give you a quick heads up.
The text in your content seem to be running off the screen in Opera.
I'm not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I'd post to let you know.
The design and style look great though! Hope you get
the problem solved soon. Kudos

I just installed the latest version of Opera and don't see any problems.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.