Skip to main content

All Questions

Tagged with
3 votes
1 answer
133 views

How can I condense my code in node.js for sorting unique values within an array?

Kattis problem - ("I've been everywhere") I would highly recommend looking at the problem through the link, however I will summarize it a bit here and explain the functionality of each part ...
doroshm's user avatar
  • 33
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 ...
mmaismma's user avatar
  • 123
1 vote
1 answer
569 views

Creating a Navbar Menu from JSON data with Lodash

I am trying to create a navbar menu from JSON data. Actually I have achieved it but I am looking for feedback not to call getItems twice? How can I improve my code? ...
nanokozmos's user avatar
6 votes
2 answers
139 views

Concatenating prefix of one array with the reversed suffix of another array

Given two arrays and two indices, I need to concatenate the prefix of the first array and the reversed prefix of the second array. For example: ...
goodvibration's user avatar
6 votes
2 answers
106 views

Ensuring Sequence of Events in an Array

The Problem I'm asking to see if there are methodically better solutions to this problem. The situation is as follows, I am receiving an array of events, they are marked by timestamp and there is a ...
Ryan Park'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
0 votes
1 answer
54 views

DoublyLinkedList for node.js

What do you think guys? ...
ElSajko's user avatar
  • 133
2 votes
0 answers
134 views

One-based array in JavaScript

One day I stumbled upon a question on Stack Overflow: How do I create an array in javascript whose index starts from 1. The top answer says that it's impossible. However, that answer was posted ...
Michał Perłakowski's user avatar
0 votes
4 answers
16k views

Move array element to the first position

I wrote an update() function to make an entry the first element in an array. ...
roger's user avatar
  • 135
2 votes
1 answer
12k views

Using promise all with push array

The code's purpose is to call to some function async given some condition was true. I've using the following code which is working as expected. Is there a way to write it better, maybe by not using ...
Jenny M's user avatar
  • 271
1 vote
2 answers
165 views

Checking if an element exists in an array efficiently and return it

I am writing a function for my node/angular app that will prompt the user with a random question that he was not asked before. To achieve this I wrote this function: ...
Idos's user avatar
  • 113
2 votes
1 answer
70 views

Periodically resizing large array

I have a simple socket.io server written in node. Everything is working just fine, however I am curious whether what I am doing is acceptable. I am especially interested in this line ...
realp's user avatar
  • 165
0 votes
1 answer
85 views

Structuring a JSON array with objects

I have a JSON array or literal (passes through JSON.parse). Requirement: an array of tasks which contains operations which are key/value pairs. Array of tasks > Array of operations (array of ...
PrivatMamtora's user avatar
8 votes
2 answers
13k views

Calculate all possible combinations of an array of arrays or strings

I'm using code adapted from this Stack Overflow question to calculate all possible combinations from an array, which may contains strings. For example: ...
Pez Cuckow's user avatar