Skip to main content

All Questions

Tagged with
7 votes
1 answer
232 views

Find the longest "common sequence" in two lists

In short, the algorithm must find the longest sequence that joins together common sequences from two lists (a more formal specification is given in the code's header). The lists are assumed to contain ...
user266319's user avatar
7 votes
1 answer
767 views

Get all partitions of an array into k non-empty sub-arrays

I am writing a function that takes an array and an integer number and returns an array of all the partitions into subarrays (so an array of arrays of subarrays). The number of subarrays is exact the ...
Joji's user avatar
  • 325
0 votes
1 answer
148 views

Can I optimize my implementation of generating Fibonacci series using recursion?

My function accepts a number, which generates total Fibonacci numbers. I am using recursion. Please follow the code below, ...
Rahul Shivsharan's user avatar
0 votes
1 answer
360 views

Asynchronous recursive function for generating a unique Id

The code below is my first purpose built asynchronous recursive function. It took me a while to figure out how to write the thing, and I would like a second opinion. It's part of a project for The ...
ablueblaze's user avatar
2 votes
2 answers
205 views

Arithmetic progression using Recursion

take an array of two numbers who are not necessarily in order, and then add not just those numbers but any numbers in between. For example, [3,1] will be the same as 1+2+3 and not just 3+1. ...
Elbasel's user avatar
  • 642
1 vote
1 answer
448 views

Recursively unpacking a javascript object

I'm seeing a React course, we were studying fundamentals of javascript for a while. We saw how to access the content of an object and display it in console. My solution for the problem of displaying ...
sɪʒɪhɪŋ βɪstɦa kxɐll's user avatar
1 vote
0 answers
372 views

Codewars: Path Finder

Task You are at position [0, 0] in maze NxN and you can only move in one of the four cardinal directions (i.e. North, East, South, West). Return true if you can reach position [N-1, N-1] or false ...
Михаил Спирин's user avatar
1 vote
1 answer
4k views

Recursively access deeply nested object

Problem Statement I need to access a deeply nested object. I could've used a 3rd party util such as Lodash but insisted myself on writing a Vanilla JS solution with a recursive strategy. Code Can this ...
Vinay Sharma's user avatar
0 votes
1 answer
337 views

Recursive Palindrome in JavaScript

Would someone review this code, and confirm that it is indeed recursive? I'm learning computer science and going through different types of algorithms. Right now, I'm focusing on recursion want to ...
andrewlundy_'s user avatar
3 votes
2 answers
1k views

Pretty print directory structure in a JSON recursively

I am trying to pretty print the directory structure defined in a JSON. I do have a solution using recursion but I'm looking for feedback on how this solution can be ...
Vinay Sharma's user avatar
3 votes
0 answers
242 views

A valid Sudoku Generator without backtracking in JavaScript

I am new to programming. I tried to write a valid Sudoku solver with backtracking, the performance is disappointing. So, I tried to generate a valid Sudoku generator without backtracking. The white ...
Jason Rich Darmawan's user avatar
2 votes
1 answer
374 views

Recursive function with Promise and setTimeout to ping DOM

I use this function in browser automation. It pings the document in the browser to check if an element we are looking for is available (useful when there is JavaScript generated async content). If it'...
M3RS's user avatar
  • 413
2 votes
1 answer
531 views

JavaScript Sudoku Recursive Solver

Thanks for all the great feedback in Part 1. I implemented a lot of it. Here is version 2. I am looking for feedback on: Recursive solve algorithm. It's too slow. I used Chrome DevTools Performance ...
RedDragonWebDesign's user avatar
2 votes
1 answer
64 views

recursive function improvement

I am creating routes from an array of menuItems. I have written a recursive function, which works fine but I think the code can be improved. So, I need you guys to review my code and suggest me some ...
Vishal's user avatar
  • 197
1 vote
1 answer
62 views

Don't include root directory in HTML tree

I've written a function to create an HTML tree from JSON. ...
oldboy's user avatar
  • 151

15 30 50 per page
1
2 3 4 5
7