Skip to main content

All Questions

3 votes
1 answer
91 views

Merge discrete integer intervals

What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
FromTheStackAndBack's user avatar
2 votes
2 answers
75 views

Calculating the sum of all k-sized sub-arrays in an array using sliding window algorithm

I need to calculate the sum of all k-sized sub-arrays in an array using sliding window algorithm. Is that a valid sliding window algorithm? If not, why? ...
Alekam's user avatar
  • 21
3 votes
1 answer
134 views

Recursive Factorial Calculation in JavaScript

...
TAHER El Mehdi's user avatar
1 vote
1 answer
233 views

Find a secret word given an array of triplets? (codewars problem)

The rules for the puzzle are: Each triplet has the rules of how the letters are ordered in the secret word (each letter is followed by the next letter inside the triplet array). all the letters of ...
Jonas's user avatar
  • 131
0 votes
1 answer
148 views

Can I optimize my implementation of generating Fibonacci series using recursion?

My function accepts a number, which generates total Fibonacci numbers. I am using recursion. Please follow the code below, ...
Rahul Shivsharan's user avatar
1 vote
2 answers
172 views

Bottom-up merge sort

I think I programmed a bottom-up merge sort, but I'm a little sceptical that it will work under any data set. By now, I've tested it with many random arrays of massive lengths, and it seems to work; ...
Krokodil's user avatar
  • 113
2 votes
3 answers
1k views

Zero Trim from array- JavaScript

The mission: Zero Trim Write a function which trims multiple zero's sequences to a single zero digit. The return value is the updated array. You are not allowed to use another array, and you need to ...
Dar_ky's user avatar
  • 83
1 vote
1 answer
166 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
1 answer
406 views

table pagination

What I'm trying to do is quite simple: my table has pagination. So if I have 12 items to show and my max items per page is 10, I will have 2 pages, one with 10 records and another with just 2. I ...
Pelicer's user avatar
  • 123
1 vote
3 answers
80 views

Javascript: Reducing redundancy of notation nested value

Hello I have this function that looks for nested value 3 levels deep currently ...
Mateen Kazia's user avatar
2 votes
1 answer
273 views

Turn an array of pairs of start and end points into an ordered series

Given an array of pairs, for example: [["Denver", "Miami"], ["Miami", "Tulsa"], ["LA", "Okmulgee"], ["Mobile", "Portland"...
JB Wilson's user avatar
  • 123
2 votes
1 answer
260 views

Algorithm to find bucket and item indices from power of two bins?

So this is building off of Algorithm for dividing a number into largest "power of two" buckets?. Here is a slight modification of the answer from there: ...
Lance Pollard's user avatar
3 votes
2 answers
494 views

Write a function to determine whether an array contains consecutive numbers for at least N numbers

I am trying to write a function to determine whether an array contains consecutive numbers for at least N numbers. For example, the input is [1,5,3,4] and ...
Joji's user avatar
  • 325
4 votes
1 answer
52 views

Counting slides shift in javascript object

Adding Dynamic Slides to a slider used by a client shifts its index, need to account for that so i wrote this simple code, but i think it's pretty lame, is there any way to improve it and accomplish ...
dmm79's user avatar
  • 141
5 votes
3 answers
609 views

How can I Implement a better version of my function find the closest number to zero?

I recently had to do a test for a job interview, and the prompt was to code a function that returns the closest number to 0 given an array of negative and positive numbers. My function works ...
Azi Code's user avatar

15 30 50 per page