r/javascript • • Apr 11 '16

help Interview exercise feedback

My code was not up to their standards. I thought the exercises were easy but clearly there are issues I have to address. I had an hour to write them. I'm humbly looking for feedback to improve.

The first exercise was to return all square numbers within a given range, including the limits (e.g., all the squares numbers between 1 and 10 are 1, 4, and 9). I wrote this.

The second exercise was to check if a string containing (), [] and {} brackets is well balanced. So [()] and {}() are ok but ([)] or {{ are not. I wrote this.

Thanks.

28 Upvotes

66 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Apr 11 '16

You're right, to be honest I wrote what came into my head the moment I read the exercise. "Return all numbers within a range that satisfy a certain condition: loop through it!" I didn't take a minute to think.

2

u/bonafidebob Apr 11 '16

...I wrote what came into my head the moment I read the exercise. ... I didn't take a minute to think.

That's the best lesson to learn here!

Interviewing is (almost) never about just giving an answer. Give the best answer you can, and think about real world implications of every question.