Skip to main content

All Questions

Tagged with
1 vote
0 answers
97 views

Nodejs Websocket pulling new data from InfluxDB

I have a nodejs server with websocket which is pulling the new data from InfluxDB and send it to client. The piece of code is this: ...
2 votes
2 answers
118 views

Find differences between two arrays

I have to identify added and deleted items between two objects with the same structure. ...
3 votes
1 answer
212 views

Update user's experience points

I have a private method in my class to update user experience. First of all, I create giveExp based on contentLength (...
2 votes
2 answers
119 views

Javascript/Node: Reducing a sorted array of pairs such that the values corresponding to the same key are summed

System/Language: I'm using plain Javascript to write this algorithm. Environment: Node 17.4.0 with a system that has ~7000 MiB of Memory and ~400GB of Storage. Input Data An (...
2 votes
2 answers
1k views

Generate all possible unique combinations of positive numbers these have sum equal to N

This is my function to generate all possible unique combinations of positive numbers these have sum equal to N. For example: If the input is 4 The output should ...
3 votes
2 answers
76 views

Javascript best way to filter out empty values and simplify reusable function

Hello I have this function that takes array of objects and takes a specific value from the object and creates array of strings that can make mapped to dropdown selector. ...
1 vote
2 answers
1k views

Calculate transaction balances and find duplicate transactions

In an interview I was asked to solve two JavaScript questions. I thought I did pretty well because I: Covered the edge cases Wrote comprehensive tests Documented the code using jsdoc The interviewer ...
4 votes
0 answers
345 views

JavaScript AVL Tree

I have been working through Introduction to Algorithms 3rd Edition, and have implemented an AVL tree through prototypal inheritance. The code presented here does work as expected based on the tests ...
6 votes
2 answers
446 views

Selection Sort Algorithm (Node.js)

I wanted to implement a selection sort and wanted to make sure that I'm doing it correctly. I wanted to do it in a way that's efficient and use recursion. Please let me know if I am doing this ...
5 votes
2 answers
2k views

Hackerrank.com - Sherlock and Anagrams

Summary: Given a string find the number of anagramic pairs of substrings of it. e.g 'abba' pairs are [a,a],[b,b],[ab,ba],[abb,bba] so we have 4 pairs. I'm wondering if anyone can help me improve my ...
2 votes
0 answers
51 views

Flatten Hierarchical Categories

I have an XLSX file that contains a hierarchical list of categories. Each category has a basic query associated with it. I need to flatten these categories which involves combining the categories. I ...
1 vote
1 answer
2k views

code to check if number is prime number

I have written a code to check if the number is prime number are not. I pass the number from command line argument, and check if the number is prime. I have written a function for it which returns ...
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, ...
8 votes
1 answer
351 views

Sieve of Eratosthenes performance; Scala very slow compared to Node.js

I am new to Scala so it might show. I am learning it for one of my classes and have to write a performance benchmark. I have written the Sieve of Eratosthenes in both Node.js and Scala, and my Node.js ...
1 vote
2 answers
97 views

Find unique range numbers

im using the following code which is working. The code provide range of random values but unique one i.e. it doesn't return the same values until the full range was provided ,what do you think and ...

15 30 50 per page