Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
2 answers
221 views

Counting duplicate elements in two sorted arrays

I've been working on an assignment that involves optimizing a duplicate finding algorithm for sorted arrays, and I'd like to get your thoughts on the implementation. Here's the code I've come up with: ...
Bryan C's user avatar
  • 31
1 vote
1 answer
168 views

Finding the closest values in a sorted list that don't go under/over

For my project I have a sorted array of objects of timestamps (in milliseconds) and I need two functions. One function should find the closest time that doesn't go over a specific amount, and the ...
Ryan Peschel's user avatar
2 votes
2 answers
3k views

Add new number to sorted array of numbers

The task is to add a new number in the array of numbers sorted in ascending order. So let's say the array is: 20,40,50,60 And the number to be inserted is 24, ...
Rahul Shivsharan's user avatar
4 votes
3 answers
166 views

My Binary Search Implementation

I have implemented binary search in JavaScript. I run it on node. I pass an comma separated string of numbers in ascending order as first argument and the number to be searched in the second ...
Rahul Shivsharan's user avatar
3 votes
1 answer
168 views

Find the minimum value in a circular list of integers

I was looking up some coding challenges and this looked like a fun one to solve. I tested it with the following values and it seems to work for those at least: [ 5, 7, 8, 9, 11, 2, 3 ] [ 5, 7, 1, 4] [ ...
Eddie Curtis's user avatar
5 votes
2 answers
3k views

Find median of two sorted arrays

Problem statement There are two sorted arrays nums1 and nums2 of size m and ...
Lin Ma's user avatar
  • 3,543
2 votes
3 answers
470 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
6 votes
2 answers
10k views

Finding greatest value in array smaller than x

Code review requested to make this code simpler, cleaner, and better. Input array is sorted. This program finds the greatest number smaller than x. So, in an ...
JavaDeveloper's user avatar