Friday, July 8, 2022

My First Ever Coding Job Interview

    Now I've worked for a couple companies already which required me to code but believe it or not none of them gave me coding interviews. I basically was thrown into the position and expected to catch up/learn what I had to and just work. Well here is my first ever coding interview and honestly I think I did horrible lol. The interview started off great, the interviewer introduced herself (who she was and how long she has been at the company), very nice person. It was then my turn to introduce myself a bit and I said my name and how I am passionate about code, and solving problems through programming. I don't remember the order of things but I will try to recall as best I can from this point. I believe she then asked me about scenarios on linux and wanted me to tell her what linux commands I would use to solve the scenario. I have linux on my resume but that was supposed to mean that I used linux and can navigate it, I didn't expect to have to remember commands for it, I mean I don't remember all the commands for windows (my daily driver). I guess its time I practice those commands for the future. Anyways now onto the part that I should've been good at.

    The question was very simple (though it wasn't immediately obvious to me because I overthought it). Return the number of days between two dates. The template code she had up was in python and while I don't code in python in my day to day, I've learned it enough through porting code etc to understand it. I then asked if I had to write the solution in python or java, to which she replied I can use any language. C# being my favorite language at the moment was what I chose. Opened Visual studio, created a new .Net 6 project and the first thing I did was recreate the class she had in her python example, no biggie. Afterwards I wrote the beginnings of what would be the GetDifference() method which is what the name of method for the solution was expected to be. Now having dealt with time in the past and all the time zone related stuff I immediately overthought the complexity of the problem. This didn't require time-zones etc but for some reason that idea stuck with me, I didn't realize it immediately, and I began to break even more than I already am. I thought, there is no way she is asking me to calculate date time accurately from scratch right? I asked... "Can I assume that months are exactly 30 days?". She (to my relief) replied yes. I thought "Oh, this should be easy now". I started to code, adding constants for the number of days in a month and months in a year so I can refer to them by name later if need be. This is around the time I realized that non of my questions had any relevance because we weren't dealing with time-zones, shoot we weren't even dealing with time, just dates. While this should make me feel better because the problem isn't as complicated as I had misunderstood it to be (to clarify this is entire my fault, I guess I was going into this expecting a much more complicated problem) but instead this error caused my mind to race. I glance over to her stream, she looked bored of it all (might have been my imagination), I had decided to say what I was doing. In hindsight I guess that was a good decision because talking to myself made me calm down a bit. Unfortunately that wasn't going to last for long. I finished my code, at this point I don't even know what logic I had just laid down, I run the program and immediately I get an error. Red everywhere, I have a micro freak-out to myself. Okay its not so bad. I fix it, this time it actually compiles, but it gives the wrong answer. I'm thinking "I Flopped, there's no recovering from this". She lets me know that the months don't have the same number of days. I thought to myself, "didn't you just say that I can assume that the months have 30 days?", maybe I was hearing things before. I go back to my code, the short little code I had written not long ago, seemed daunting and alien to me. I changed up the design, looking up how many days there were in each month and how many days are in Feb on leap years. I didn't know what I was even doing anymore. I somehow manage to focus on the array I had made to keep count of the number of days per month and from there I was able to focus a bit more on the flow of the code. My answer was off by about double, so I told myself it has to be the loop which counts the days for a year. I go to the loop and I see a potential issue, I added the "- 1". At this point I'm numb, I speak... "I don't know if this will work until i try it I guess", shoot... I didn't mean to say that out loud, I paused for the split second from the awkwardness. I click run, okay it compiles, and to my surprise the result was.... WRONG. I thought "Just kill me", if I cant even write a program to solve this easy problem, then how are they going to believe I have any competence in coding and solving problems. Sorry to say but at this point I had no energy, I was drained and I honestly didn't know where to even start debugging because my mind was in another universe. I was defeated. The defeat I had would be solidified as the interviewer said "its okay, you dont have to get the exact answer". I knew that because the number of days was indeed deterministic there should be no excuse why I couldn't provide the correct exact number. I was maybe 2 weeks off but because of the properties I just stated, that might as well be infinitely wrong.

    We ended the interview on a good note (or just my wish) with smiles although her smile might have been my imagination (she is nice and I was still in lala-land), but my smile was one which took effort to put on. I was a failure, there was nothing I could smile about. I look at my phone, and told my friends about the interview and how I felt about it. Some tried to cheer me up, some jokingly made fun of me, and of course some couldn't care less (these guys help me snap back to reality). I then sat there for a bit thinking about the interview and then tried telling myself "well the problem isn't solved until its solved". I hopped back on visual studios and proceeded to read my code. It's unbelievable how much more clear everything is when anxiety isn't tugging on your heart strings. I had made several mistakes and these where easily spotted if I had just read the code properly. In the ported code, the constructor takes 3 parameters which were day, month, year, in that order and all ints. When I went to create them in "program.cs" I had incorrectly used the wrong format of month, day, year. The dates I put there were probably wrong to begin with since I was dazed as all heck when she was reading them to me. The other issue I found was that the calculation for adding days to the total tally for a year was wrong. I fixed that as well and used https://www.timeanddate.com/date/duration.html to check my answers, each time with different dates. This all took no time at all and yet I couldn't do it during the interview. I thought I'd at least push it up to my git to add to my portfolio lol, for what its worth. I still have an in person interview tomorrow so I really hope I do better there.

ADDED: I forgot that during the coding portion she also pointed at the keyword "internal" and asked what it was for. I didn't really know what she was asking so I replied with "I can turn it to public if you want", I proceeded to change internal to public. She further explained that she wanted to know what it was and what its used for. I told her that it was an access modifier and that it used to let the the rest of the program see the class and its members. Now thinking back on it, maybe that was too simplistic of an explanation? darn it, I did horrible on that whole interview.

IN-PERSON:

    Now the drive there was pretty uneventful but as I got closer and closer to my destination, I can feel my heart rate quicken. I followed the instructions on the email I got for parking and parked the car. I started walking up the hill, with every step I realized more and more where I was. This was not some small startup, I was reminded that this is a big established company. I walk into the building and tell the front desk that I'm there for the interview. I sit and wait in the lobby, and I am dazed, I'm staring out the front window thinking "I can't believe I'm here". My interviewer introduced himself and I immediately missed his name, I reactively ask for his name again and then told him my name. I get my visitor
s sticker and I follow him. We reached the elevators and we got in. Yup just me and him in the elevator, I need to relax, so I breathe deeply but slowly. He breaks the silence by asking me how I pronounced my name, I told him its like saying the letters 'T' and 'N' and furthered it by saying I tell people that if they've watched DragonBall Z its just like the character Tien. Unfortunately he hasn't seen the show so I just reaffirmed that its just the letters 'T' and 'N'. We walk and entered a corner room. Two of the walls were glass and the other two were what seemed to be white boards. He further introduced himself and basically what they do there. I remember thinking this is some official shiz lol. I was then asked to give more of an in depth introduction about myself. I said I was passionate about coding, and I like making tools for people, and my hobby is coding to ultimately get better and learn new things etc. We proceed to talk about my reasons for leaving my previous place of employment and explaining the gap. He then explained to me that not everything there was going to be orderly and optimal and that it isn't going to go my way. I completely understood and thought it was perfectly reasonable. I guess I came off as if I left the old place because they didn't do things perfectly. I hope I reassured him that isn't the case. He was very level with me and honestly great to converse with. We also talked about teamwork and agile. I told him that at my old workplace we did agile but I wasn't too sure if it was what we actually did. By the end of the interview I essentially told him my strengths and weaknesses. I also asked a couple questions like "with the conversation we had thus far, how do you think I fare". He said he saw some of my code on GitHub but unfortunately he didn't look at one I had hoped people would look at which at the moment is BijouDB. I mean the one he looked at wasn't really bad I think but I don't think it is as impressive. Id like to get along with this interviewer seeing as potentially he would be my Lead but also to pick his brain and learn things lol.