All Questions
Tagged with complexity javascript
37 questions
5
votes
2
answers
836
views
Simplify complexity [closed]
I came across this question which asks to create a function which will return true/false based on the passed array containing all the letters to make up the passed word. Each letter from array can ...
3
votes
1
answer
141
views
Handwriting progressive drawing
Implementation to progressively draw symbols, when provided with symbol implementations it supports any type of symbols, though for the review purpose just two hand written latin symbols are supported ...
1
vote
2
answers
1k
views
Leetcode 55. Jump Game solution
I was working on Jump Game problem on leetcode
Question
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ...
1
vote
2
answers
428
views
group countries by language in JavaScript
I need a better implementation than the below code (O(N) Solution), I am grouping countries by language ( data ) is the countries JSON, each country could have 0, 1 .. or more language as the object ...
-2
votes
2
answers
135
views
3
votes
4
answers
216
views
Is this an efficient/correct way to get largest Prime factor?
Is this an efficient way to get the largest prime factor of a given number? Other solutions I found involved nested algorithms.
...
4
votes
2
answers
5k
views
Merge arrays in objects in array based on property
I have the following code which takes an array that might have duplicate ids and will merge the items of those duplicate, and ...
4
votes
1
answer
732
views
Performant Sort function for big arrays
In sort(arr), I want to sort an array. Children must be beneath their parent. And children of the same parent are sorted using ...
3
votes
2
answers
147
views
Cyclomatic Complexity (complexity)
I have a program for finding shortest distance/path and I got a correct answer but I am getting an issue i.e., "Function 'shortestPath' has a complexity of 9. Maximum allowed is 6." This is ...
3
votes
1
answer
98
views
Count number of square integers in a given range of ints (faster function?)
The function below passes most test cases:
...
2
votes
1
answer
408
views
Car Pooling algorithm time complexity
I created a solution for the car pooling algorithm.
Problem:
You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot ...
3
votes
0
answers
138
views
Benchmarking multiple implementations of a Code Kata: queue for the self-checkout tills at the supermarket
I was reading this question:
Why is my function timing out when run with a larger data set?
And although I couldn't quite grasp the OP's implementation and so didn't feel like answering.
I did some ...
3
votes
1
answer
115
views
Finding Common Items in arrays
My goal is to get a list of related statementIds in order of most repeated.
In my database I have stems(Words):
...
2
votes
1
answer
106
views
Circular Doubly Linked List with generators
I didn't find an implementation on CR of the circular doubly linked list, using generators. Hence, I tried it myself.
Description
The class Deck represents a ...
-2
votes
1
answer
197
views
Challenge - Construct binary tree from array [closed]
A coding challenge to construct a binary tree from an array.
...