Skip to main content

All Questions

3 votes
1 answer
91 views

Merge discrete integer intervals

What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
FromTheStackAndBack's user avatar
4 votes
2 answers
1k views

implement the merge functionality for 2048 with JavaScript

I am trying to implement the game 2048 using JavaScript. I am using a two-dimensional array to represent the board. For each row, it is represented using an array of integers. Here I am focused on ...
Joji's user avatar
  • 325
4 votes
2 answers
854 views

JavaScript implementation of Symbol Table (Dictionary)

I'm currently going over Robert Sedgewick Algorithms book. Here I'm implementing a Symbol Table using a Linked List. The Sequential Search Symbol table is implemented in JavaScript. The book mentiones ...
Steven Aguilar's user avatar
0 votes
1 answer
288 views

Find missing element in an array of unique elements from 0 to n

The task is taken from LeetCode Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. ...
thadeuszlay's user avatar
  • 3,981
6 votes
2 answers
12k views

Poker game in JavaScript

I am creating a Poker game using the follow hand precedence (winning hands in descending order): So if the player enters 5 cards: TH JH QH KH AH (i.e. 10Heart JackHeart QueenHeart KingHeart AceHeart)...
Mubi's user avatar
  • 71
7 votes
5 answers
4k views

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
1 vote
1 answer
142 views

Object-to-array flattening function

I have written a function that is designed to convert an object into an array of key/pair values ("flattening it") like so: Input ...
Jack Wilsdon's user avatar
  • 1,651
8 votes
8 answers
2k views

Free Code Camp - Pairwise

I'm working through the Free Code Camp syllabus and I'm on to Intermediate JavaScript Algorithms. This Pairwise problem was the last challenge in that section. The section came just after "Object ...
John Behan's user avatar
2 votes
1 answer
102 views

Returning Function Calls from an Array within a JavaScript Function

I'd like to use JavaScript to generate HTML. I've made a JavaScript function object that has two parameters; a string and generic object. The string is used to specify the type of HTML element you ...
Jason's user avatar
  • 21
3 votes
1 answer
799 views

Quick sort implementation in JavaScript in prototype style

I have implemented quickly the quick sort algorithm in JavaScript using prototype based style. The code is rather short (http://jsfiddle.net/b8mfY/): ...
user avatar
5 votes
1 answer
5k views

Javascript PriorityQueue based on object property

I wrote this class which is a priority queue based on a numeric property of any object. As far as I can tell, the following code is working as intended. Are there any stylistic tendencies that I am ...
prettymuchbryce's user avatar