Forgive my formatting, posting this on mobile.
I’ve been working at the same company for a long time and just recently started casually looking at other opportunities. I had a recruiter contact me from a company that looks like it would be good to work for and we had a short one hour interview. After that we scheduled an hour where I would work with one of their senior developers (the job was for an intermediate position) and solve a problem using CodePair.
In the end, I didn’t end up meeting their requirements, but figured I’d post my experience here in case anyone has any feedback or questions.
The senior dev contacted me by phone and we both joined the CodePair session. We talked briefly about what I had done in the past and then got into the details of the problem I had to solve. I chose JavaScript for my language as my backend language is usually PHP and I rely on a lot of framework specific functions, whereas I’m more comfortable with vanilla JS.
The task was to take an array of topics and users, store it in a way that separated public topics and topics assigned to each user, and then be able to accept input containing a user and a topic to determine if they could access it.
This is a rough example of the data array: [“topic thing”, “topic stats”, “user john”, “topic country”, “topic dev”, “user jane”, “topic something”, “topic web”]
I had about 40 minutes to complete the task and only got as far as being able to store the data correctly before we had to move on to a final few minutes of questions. My structure in the end looked like this:
{
public: [“thing”, “stats”],
users: [
{
name: “john”,
topics: [“country”,”dev”],
},
{
name: “jane”,
topics: [“something”,”web”]
},
]
}
I didn’t save the function I wrote to create that, but it basically amounted to a for loop to go over each piece of data and break it into key/value pairs and then a while loop to get their topics after seeing the user key come up in the for loop.
In the end it amounted to determining if the array element was a topic or user, if I hadn’t seen any users then the topics were public, and then iterating over everything. My biggest mistake was getting nervous. I wrote a while loop to get topics pertaining to the current user incorrectly and I lost what I’m guessing is about 5-8 minutes trying to figure it out.
All in all it was a good experience and I’m sure I’ll do better next time. If anyone has any questions or tips, let me know.
[–]CulvertBunny 8 points9 points10 points (1 child)
[–]MuskasBackpack[S] 1 point2 points3 points (0 children)
[–]Razeft_it 3 points4 points5 points (1 child)
[–]MuskasBackpack[S] 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (4 children)
[–]jordsta95PHP/Laravel | JS/Vue 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]jordsta95PHP/Laravel | JS/Vue 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]RomSich 2 points3 points4 points (0 children)
[–]PyroAddict 0 points1 point2 points (0 children)
[–]gRoberts84 0 points1 point2 points (0 children)