webdev: (Default)
[personal profile] webdev
Over on his blog Arden Dertat has an excellent series of articles about common interview questions and their solutions. He discusses multiple solutions for almost every problem and talks about their complexities and other advantages and disadvantages. They're a really excellent series of articles and I highly recommend them.

Arden has done many of the solutions in Python or C. I decided it would be helpful to review the questions and present solutions in JavaScript, especially where JavaScript provides its own solutions that Python or C do not. After all, web application development often employs many of the techniques these questions illustrate: string and array manipulation, basic data structures, algorithms and optimization. I won't repeat Arden's excellent discussions of the details (I doubt I could do better), but I will be adding my own observations. I'll also be posting my code on Github as I go.

If anyone has worked through these examples in another language--even if it's just a repo on Github--let me know!

Question 1: Array Pair Sum. Given an array of random integers, output the pairs that add to a given number k.

Question 2: Matrix Region Sum. Given a matrix of integers and coordinates of a rectangular region within the matrix, find the sum of numbers inside the rectangle.

Question 3: Largest Continuous Sum of an Array. Given an array of positive and negative integers, find the largest continuous sum.
Anonymous (will be screened)
OpenID (will be screened if not validated)
Identity URL: 
Account name:
If you don't have an account you can create one now.
HTML doesn't work in the subject.


If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.