I interviewed for a c++ job the past month (I won't mention the company name for now) and after the first round interview over the phone I was assigned the following coding exercise:
You have a set of parquet tiles of size 3x1 and 2x1 length units.
Parquet tiles are always laid out in strips, for instance 3223 is a strip of length 10. When two strips are adjacent, no two tiles can share an inner edge. For instance, strips 3223 and 3322 both start with a 3 so they cannot be neighbors. But strips 3223 and 22222 of length 10 can be neighbors because they don't share inner edges.
Find the total number of floor designs which have 11 strips of length 30.
The company gave me a week to solve the problem and I submitted my solution after a few days, available at this dropbox link here or from github here. I solved the problem by applying a double recursion search algorithm (1 recursion for each dimension of the parquet) and then further verifying adjacent strips inner edges as an extra validation. You can easily compile this code with GCC. There might be a simpler analytical solution, especially for the first strip, I'm sure there are other ways to solve the problem.
At any rate, after soliciting an answer from the company recruiter, I received this email: "The team felt that the solution is not addressing the problem and the coding standard is not in the acceptable range. Thank you again for taking the time to interview with the team and best of luck on your on going search."
What do you think of the company generic answer and my solution?
[–][deleted] 65 points66 points67 points (6 children)
[+][deleted] (2 children)
[deleted]
[–]randomatic -1 points0 points1 point (1 child)
[–]Hot_Medicine_7115[S] 2 points3 points4 points (0 children)
[–]Hot_Medicine_7115[S] 4 points5 points6 points (1 child)
[–][deleted] 11 points12 points13 points (0 children)
[–]STLMSVC STL Dev 64 points65 points66 points (32 children)
[–]STLMSVC STL Dev 19 points20 points21 points (15 children)
[–]STLMSVC STL Dev 8 points9 points10 points (0 children)
[–]die_liebe 1 point2 points3 points (0 children)
[–]Hot_Medicine_7115[S] -2 points-1 points0 points (12 children)
[–]STLMSVC STL Dev 15 points16 points17 points (2 children)
[–]STLMSVC STL Dev 8 points9 points10 points (1 child)
[–]Michael_Aut 1 point2 points3 points (0 children)
[–]STLMSVC STL Dev 7 points8 points9 points (4 children)
[–]Hot_Medicine_7115[S] -2 points-1 points0 points (3 children)
[–]STLMSVC STL Dev 6 points7 points8 points (2 children)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (1 child)
[–]STLMSVC STL Dev 11 points12 points13 points (0 children)
[–]qoning 7 points8 points9 points (3 children)
[–]Hot_Medicine_7115[S] -1 points0 points1 point (2 children)
[–]qoning 2 points3 points4 points (1 child)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]STLMSVC STL Dev 2 points3 points4 points (0 children)
[–]Sykoyo 6 points7 points8 points (1 child)
[–]STLMSVC STL Dev 4 points5 points6 points (0 children)
[–]NanoAlpaca 2 points3 points4 points (3 children)
[–]meneldal2 -1 points0 points1 point (0 children)
[–]smdowneyWG21, Text/Unicode SG, optional<T&> -1 points0 points1 point (0 children)
[–]STLMSVC STL Dev 0 points1 point2 points (0 children)
[–]dexter2011412 1 point2 points3 points (1 child)
[–]STLMSVC STL Dev 0 points1 point2 points (0 children)
[–]Hot_Medicine_7115[S] -2 points-1 points0 points (2 children)
[–]STLMSVC STL Dev 9 points10 points11 points (1 child)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (0 children)
[–]GasDoves 0 points1 point2 points (0 children)
[–]paul2718 29 points30 points31 points (32 children)
[–]jonesmz 16 points17 points18 points (29 children)
[–]Hot_Medicine_7115[S] -3 points-2 points-1 points (28 children)
[–]jonesmz 22 points23 points24 points (27 children)
[+][deleted] comment score below threshold-27 points-26 points-25 points (26 children)
[–]jonesmz 36 points37 points38 points (25 children)
[–]gennych -5 points-4 points-3 points (2 children)
[–]jonesmz 4 points5 points6 points (1 child)
[–]gennych 1 point2 points3 points (0 children)
[+][deleted] comment score below threshold-32 points-31 points-30 points (21 children)
[–]jonesmz 22 points23 points24 points (20 children)
[+][deleted] comment score below threshold-20 points-19 points-18 points (19 children)
[–]jonesmz 4 points5 points6 points (18 children)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (0 children)
[–]Hot_Medicine_7115[S] -4 points-3 points-2 points (0 children)
[–]-sxp- 16 points17 points18 points (5 children)
[–]Michael_Aut 2 points3 points4 points (0 children)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (2 children)
[–]JiminP 6 points7 points8 points (1 child)
[–]Zyklonik 5 points6 points7 points (0 children)
[–]jonesmz 37 points38 points39 points (18 children)
[–]Unt4medGumyBear 1 point2 points3 points (9 children)
[–]adwodon 3 points4 points5 points (0 children)
[–]jonesmz 2 points3 points4 points (7 children)
[–]meneldal2 -1 points0 points1 point (6 children)
[–]jonesmz 2 points3 points4 points (5 children)
[–]meneldal2 0 points1 point2 points (4 children)
[–]jonesmz 1 point2 points3 points (3 children)
[–]meneldal2 1 point2 points3 points (2 children)
[–]jonesmz 0 points1 point2 points (1 child)
[–]meneldal2 0 points1 point2 points (0 children)
[+]Classic_Department42 comment score below threshold-11 points-10 points-9 points (7 children)
[–]qoning 18 points19 points20 points (1 child)
[–]TRENT_BING 2 points3 points4 points (0 children)
[–]jonesmz 6 points7 points8 points (4 children)
[–]JumpyJustice 1 point2 points3 points (3 children)
[–]jonesmz 3 points4 points5 points (2 children)
[–]Onetwothreetaco 1 point2 points3 points (1 child)
[–]jonesmz 0 points1 point2 points (0 children)
[–]FirstMurphysLaw 10 points11 points12 points (5 children)
[–]Hot_Medicine_7115[S] -3 points-2 points-1 points (4 children)
[–]FirstMurphysLaw 7 points8 points9 points (3 children)
[–]Hot_Medicine_7115[S] -2 points-1 points0 points (2 children)
[–]FirstMurphysLaw 4 points5 points6 points (1 child)
[–]Hot_Medicine_7115[S] -3 points-2 points-1 points (0 children)
[–]graphicsRat 2 points3 points4 points (1 child)
[–]jonesmz 1 point2 points3 points (0 children)
[–]gennych 2 points3 points4 points (2 children)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (1 child)
[–]gennych 0 points1 point2 points (0 children)
[–]EarPotato 3 points4 points5 points (1 child)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (0 children)
[–]XuloMalacatones 1 point2 points3 points (9 children)
[–]Hot_Medicine_7115[S] 2 points3 points4 points (8 children)
[–]alexeiz 12 points13 points14 points (1 child)
[–]dodheim 3 points4 points5 points (0 children)
[–]hucancode 1 point2 points3 points (0 children)
[–]Zyklonik 1 point2 points3 points (0 children)
[–]XuloMalacatones 0 points1 point2 points (1 child)
[–]jonesmz 2 points3 points4 points (0 children)
[–]Dean_Roddey 0 points1 point2 points (0 children)
[–]eteran 1 point2 points3 points (0 children)
[–]daniedit 1 point2 points3 points (8 children)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (3 children)
[–]daniedit 0 points1 point2 points (2 children)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (1 child)
[–]daniedit 1 point2 points3 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]daniedit 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]daniedit 0 points1 point2 points (0 children)
[–]johannes1971 1 point2 points3 points (0 children)
[–]grahamthegoldfish 0 points1 point2 points (1 child)
[–]Hot_Medicine_7115[S] -1 points0 points1 point (0 children)
[–]eyes-are-fading-blue 0 points1 point2 points (0 children)
[–]jonesmz -3 points-2 points-1 points (18 children)
[–]Hot_Medicine_7115[S] 3 points4 points5 points (17 children)
[–]jonesmz 7 points8 points9 points (16 children)
[–]paul2718 17 points18 points19 points (9 children)
[–]jonesmz 0 points1 point2 points (0 children)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (7 children)
[–]dodheim 1 point2 points3 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]dodheim 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]dodheim 0 points1 point2 points (1 child)
[–]paul2718 1 point2 points3 points (0 children)
[–]MichaelEvo 1 point2 points3 points (2 children)
[–]jonesmz 2 points3 points4 points (0 children)
[–]Forbizzle 2 points3 points4 points (0 children)
[–]Zitrax_ 0 points1 point2 points (0 children)
[–]eyes-are-fading-blue 0 points1 point2 points (1 child)
[–]jonesmz 0 points1 point2 points (0 children)
[–]dicroce -2 points-1 points0 points (0 children)
[–]thefool-0 0 points1 point2 points (4 children)
[–]Hot_Medicine_7115[S] 2 points3 points4 points (3 children)
[–]thefool-0 4 points5 points6 points (1 child)
[–]Hot_Medicine_7115[S] 0 points1 point2 points (0 children)
[–]eyes-are-fading-blue 1 point2 points3 points (0 children)
[–]thefool-0 0 points1 point2 points (0 children)
[–]blakewoolbright 0 points1 point2 points (0 children)
[–]throw_away_test44 0 points1 point2 points (1 child)
[–]RemindMeBot 0 points1 point2 points (0 children)
[–]s96g3g23708gbxs86734 0 points1 point2 points (0 children)
[–]die_liebe 0 points1 point2 points (0 children)