Skip to main content

All Questions

1 vote
2 answers
852 views

Merge two sorted arrays that can be of different sizes

I think the algorithm implementation itself is reasonably efficient, but I'm not sure about proper use of good practices in software development in the code (variable naming, idioms, comments, error ...
Matheus Deister Veiga's user avatar
6 votes
1 answer
1k views

Multiple stacks implemented via a linked lists on top of single fixed-size array

Problem Statement Originally, the problem is defined in the book as following: Describe how you could use a single array to implement three stacks. — Cracking the Coding Interview (6th edition) ...
Igor Soloydenko's user avatar
5 votes
3 answers
126 views

Array's reverse vs simple arithmethic

I was asked to print numbers from 100 to 1 in a for loop with the index starting from 1. I came up with this solution: ...
Alish Dhamala's user avatar
2 votes
3 answers
469 views

Minimum element in a sorted rotated array

A sorted array [0,1,2,3,4,5] when rotated n times (3 times in this case) becomes [3,4,5,0,1,2], meaning elements in the front move to the end. The code below finds the minimum element in this array, ...
Software Engineer's user avatar
4 votes
3 answers
2k views

Removing duplicates from an array

I recently wrote this JavaScript algorithm for removing duplicates from an array as part of a job interview process, but was turned down for the position after submitting the code. I didn't receive ...
jmknoll's user avatar
  • 141
12 votes
7 answers
31k views

Given an array of integers, return all pairs that add up to 100

I was recently given this programming challenge on an interview, and I decided to use javascript to solve it. I did, but I'm not happy with my implementation. I can't help thinking there must be a ...
Jan Drewniak's user avatar