Fabrix Interview Question for Software Engineer / Developers


Country: israel
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

Good question. Not sure what they would be looking for, apart from some heuristics and backtracking etc.

- Anonymous March 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

There are sets of geometrical forms for which the problem is NP-complete (easy reduction from tiling a square with Wang tiles). So if you have an efficient algorithm (polynomial time) for the question, you don't need the job :-)

- Anonymous March 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

even if the problem is NPC, there has to be some algorithm (by the way, I did not talk about efficiency in the question).
What they want is to see how you think, and try to solve the problem.
What I saw is banal recursion algorithm where you try in fact all the possible combinations.

- nathasion March 21, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I'd start with some greedy algorithm that basically simulates the decisions that a human Tetris player makes. Just iterate through the shapes, and drop them to the lowest level possible. Orient each shape so that it's longest side is on the bottom, then find the lowest level that provides a long enough platform for the whole bottom to sit on top.

Adding T-shapes and L-shapes to the mix creates the necessity of having handling "holes" and plugging holes. When you encounter a T-shape or L-shape, look for a way that it can snugly fill a hole; otherwise, push it to the end of the queue.

Consider shapes that fit nicely together. Two troublesome Ls can be joined together to make a rectangle. You can preprocess your list in advance to try to pair up Ls.

Eventually, you'll want some kind of backtracking scheme. You provisionally place a piece, but maybe subsequent pieces can't plug the holes it creates. If so, roll back and try another piece.

Definitely not a trivial problem.

- showell30@yahoo.com March 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

One metaphor for this problem is that you have a mating game. You have a bunch of piece that want to mate. When two pieces mate, they create a child, and the parents die off. All pieces--single and combined--have a "survival fitness" tied to them. A piece's fitness is a measure of how well it mates with other pieces to form other nice shapes. At any stage of the mating game, you're trying to first mate off pieces with the lowest survival probability, so that you can kill them off and let their children prosper.

Before the game even starts, you can do some analysis on piece types, including small compound pieces, to create a compatibility graph, where the nodes are piece types, and the weight of the edges to other piece types indicates some sort of inclination for ideal mating.

A greedy algorithm would start with the most troublesome piece, and then iterate through the compatibility graph to find types to mate to, checking the actual bag of pieces to find out if there available mates for that type. Then marry the pieces, create the child, and kill the parents.

- showell30@yahoo.com March 22, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More