Skip to main content

All Questions

Tagged with
9votes
2answers
10kviews

How can I quickly find unique list items?

I use the loop-every-single-list-item approach to filter out unique elements in a given list, which tends to be very inefficient way as a list grow in size, or as function call frequency increases. ...
Nikola Vukovic's user avatar
10votes
2answers
240views

Associating degrees with notes of scales

I have a JS file that creates an object with notes from a music scale when given a key (aka tonic/ note). The code works and does what I want it to do. I need a critique on the way it's written, what ...
isosceles's user avatar
23votes
3answers
141kviews

Removing duplicates from an array quickly

...
eddie's user avatar
14votes
1answer
10kviews

Implement numbering scheme like A,B,C... AA,AB,... AAA..., similar to converting a number to radix26

I want to implement numbering scheme like Microsoft Word uses for numbering. first one gets = A,next is B, next is C, .... then AA, then AB,....and so on. as shown below ...
sbr's user avatar
  • 243
12votes
1answer
621views

Heaviest Stone algorithm time complexity

I implemented the heaviest stone algorithm, but I am not sure about its time complexity. I'm doing sort which is O(nlogn), but it' inside a while loop. Problem: We have a collection of stones, each ...
myTest532 myTest532's user avatar
12votes
7answers
31kviews

Given an array of integers, return all pairs that add up to 100

I was recently given this programming challenge on an interview, and I decided to use javascript to solve it. I did, but I'm not happy with my implementation. I can't help thinking there must be a ...
Jan Drewniak's user avatar
10votes
4answers
2kviews

Algorithm for dividing a number into largest "power of two" buckets?

For example, these are expected outputs: 3: 2, 1 4: 4 5: 4, 1 6: 4, 2 7: 4, 2, 1 8: 8 9: 8, 1 ... 20: 16, 4 ... 25: 16, 8, 1 ... 36: 32, 4 ... 50: 32, 16, 2 Up to ...
Lance Pollard's user avatar
7votes
5answers
4kviews

Find number repeated odd times in array

I completed the following exercise: You are given an array of repeating numbers. All numbers repeat in an even way, except for one. Find that odd occurring number. ...
user7496931's user avatar
5votes
1answer
4kviews

Interview Coding Test: Transaction Processing: Get balance by category in given period

I recently gave a coding test for a job which failed. It had two problems and one of them is shared in this question along with my solution. Problem: Get balance of all transactions in a given ...
SamFast's user avatar
4votes
1answer
173views

Improving a filter array function, to match elements and conditions

I have to do some check/match elements with conditions. A have a list of conditions, each with a specific ID. I've put for each of my elements an array with the ids of their respective affirmative ...
Rafael de Castro's user avatar
4votes
1answer
220views

Displaying Media with HTML and JavaScript

I have a personal website that I use to share videos and images with friends. Below is a media generator using JavaScript and HTML. Its main purpose is to display one image at a time at the click of a ...
user avatar
4votes
3answers
25kviews

"Prev" / "Next" buttons for a circular list

I have an array of strings and on click of the "NEXT" button it displays the next array item in a <p> tag while on click of the "PREV" button it displays the ...
Redu's user avatar
  • 926
3votes
2answers
494views

Write a function to determine whether an array contains consecutive numbers for at least N numbers

I am trying to write a function to determine whether an array contains consecutive numbers for at least N numbers. For example, the input is [1,5,3,4] and ...
Joji's user avatar
  • 325
3votes
1answer
100views

Transforming an array of arrays into an array with joins

I'm transforming this: ...
docodemore's user avatar
3votes
1answer
163views

Train Travel Planner

I did an exercise of a train travel planner. But it seems like a lot of code to do a simple thing? Is there a better way of writing the JavaScript? Overview: The planner needs to be able to find ...
Ray Tsai's user avatar

153050per page
close