Skip to main content

All Questions

Tagged with
8votes
3answers
2kviews

Javascript split array into n subarrays, size of chunks don't matter

NOTE: This post was moved from stackoverflow as codereview.stackexchange is a better place to discuss the performance of this code problem/solution. I want to split ...
5votes
3answers
302views

Largest Triple Products without using sort?

I implemented the Largest Triple Products algorithm, but I use sort which makes my time complexity \$O(n *log(n))\$. Is there a way to implement it without a temporary sorted array? The problem: You'...
3votes
1answer
91views

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 ...
3votes
2answers
86views

Optimize Working Live Search & Highlight Function

I've written a custom Live Search & Highlight function in vanilla JS. It is working and does what I expect it to. The issue is that the more items I add to the page content to search, the slower ...
6votes
5answers
485views

Fill missing data in between available data with default value

My raw data has values on some random times: const rawData = [ {hour: 3, value: 3} , {hour: 5, value: 9} , {hour: 10, value: 5} , ] as const I would like to ...
4votes
1answer
170views

Array Implementation In JavaScript

Review I have written my own implementation of Array in JavaScript with the basic functionalities. Can anyone please review this code and point out the mistakes/how to make the implementation better? ...
3votes
2answers
324views

Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values

Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
2votes
1answer
63views

JS animated string builder

Today, I tried to write a simple function that would display the characters of my string one by one by iterating over a string containing the letters of the alphabet and showing the steps on the ...
2votes
2answers
493views

Merge sort implementation using divide-and-conquer

I was told in an interview to write a program for implementing merge sort on the concept of divide-and-conquer. ...
2votes
2answers
75views

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? ...
2votes
1answer
63views

Exponentiate common factors with JavaScript

I've created a function that exponentiates common factors. I'd like to optimize/simplify it because, as you can see, it's very messy and not very performant ...
2votes
0answers
83views

Javascript basic search engine recipes

I have made a search engine for recipes. Requirements for this JS Project are as follow: Create a function called searchRecipes that takes all recipes and an ...
3votes
1answer
134views

Recursive Factorial Calculation in JavaScript

...
3votes
0answers
59views

extracting values from an array of nested objects without duplicates

I have my solution for the below usecase but I would like to know whether is any other effective solution for the same. My Data: ...
2votes
2answers
71views

Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range

I'm trying to optimize a function that takes a sorted list of integers and tells me what is the maximum number of elements in the list between any definite size range. To be clear, the range itself ...

153050per page
close