All Questions
35 questions
2
votes
3
answers
198
views
Efficiently tagging first and last of each object matching condition
How can I make the code more readable and more efficient? (provided code is O(n²) time, but intuition says it can be pre-processed and done in O(n) time)
Description
it tags the first and last of ...
0
votes
1
answer
101
views
Create and store the level data for a remake of Super Mario Bros game
I am trying to remake Super Mario Bros. in JavaScript and I am trying to figure out if there is a more efficient/shorter way to create and store the level data. I have created 1-1 and here's what the ...
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 ...
4
votes
2
answers
3k
views
Download entire localStorage as file
I would like to download the entire contents from localStorage to a json file (in a "clear" formatting).
I've tried this and it works perfectly. However, ...
0
votes
1
answer
94
views
custom array sorting algorithm
So I came up with a "new" sorting algorithm:
...
-2
votes
2
answers
111
views
4
votes
2
answers
657
views
How to implement a 2D Cellular Automaton in JavaScript?
So far I have this:
...
5
votes
1
answer
182
views
Generate all partitions of a set of items
Here are the items:
var item = ['a', 'b', 'c', 'd'];
Desired output:
...
0
votes
2
answers
56
views
Looping Array object with conditions and comparison the performance with ECMA VS Vanilla JS
The Plain vanilla JS needs to converted in to advanced ECMA. The below 3 snippets shown yields the correct result. Need to identify which among them is performance oriented
...
7
votes
2
answers
234
views
Game of Life state calculation in javascript
I've created a Game of Life implementation in JavaScript with the goal of having it be as fast as possible, with the rendering I'm satisfied (see picture bellow), however the next state calculation is ...
0
votes
1
answer
340
views
Efficiently performing multiple nested grouping and mapping in Javascript
I have an array of log objects with log_types and dates, like this:
...
5
votes
1
answer
4k
views
Pattern usage for increment / decrement React (Hooks)
When asked to increment / decrement a particular value I usually create specific functions to handle this functionality. Like this:
...
5
votes
2
answers
107
views
JS Custom Event System
I've written the following custom event system module and I'm planning to use it in production in the future. Before I do that, I'd like to ask for general suggestions on how to improve it. Thanks a ...
2
votes
1
answer
71
views
Find words from dictionary method. Performance improvements
I've implemented a method to solve the following problem:
Given a dictionary and a text string, find all words from the
<...
5
votes
2
answers
520
views
Frequency Queries (Hackerrank)
This is the problem:
You are given queries. Each query is of the form two integers described below:
1 x: Insert x in your data structure.
2 y: Delete one occurrence of y from your data ...