All Questions
51 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 ...
3
votes
2
answers
86
views
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 ...
3
votes
2
answers
324
views
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 ...
3
votes
0
answers
59
views
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:
...
2
votes
2
answers
71
views
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 ...
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 ...
0
votes
3
answers
2k
views
Sum up nested array of objects based on keys
I have this function that should take some array of objects and sum up the values of the inner objects based on some keys, and conditionally add to it some values from another object.
Is there a way ...
3
votes
1
answer
204
views
Randomly set styles with JavaScript
I have created a function which randomly sets styles using CSS selectors. Right now it returns a random item from an array. The program also works with shorthand properties (such as ...
1
vote
3
answers
148
views
Replace array values with product of all other values
Need help to optimize the following code for lower time complexity:
...
2
votes
2
answers
125
views
Complex Filter in one Opration
I am working on a Data-based application.
I wrote a code to filter the table.
The table has String and Numbers.
I some filter ...
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
...
2
votes
1
answer
86
views
Generating a performance report for clans in Clash Royale
The following code generates a report showing performance of clan members in a game called Clash Royale.
Everything is pretty self-explanatory, we are working with a lot of https requests, arrays and ...
5
votes
1
answer
183
views
Generate all partitions of a set of items
Here are the items:
var item = ['a', 'b', 'c', 'd'];
Desired output:
...
3
votes
2
answers
112
views
Insert into array in reverse while iterating forward
So currently I have this function:
...
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:
...