Skip to main content

Questions tagged [backtracking]

3 votes
2 answers
117 views

I just solved the following Leetcode problem: All Paths From Source to Target Here is my solution: ...
Platus's user avatar
  • 127
-2 votes
1 answer
71 views

I'm trying to solve the following Leetcode problem: https://leetcode.com/problems/path-sum-ii/description/ This solution I came up with is working: https://pastebin.com/ma3DtU5b However, I was not ...
Platus's user avatar
  • 127
0 votes
1 answer
96 views

The following is a Leetcode problem: 473. Matchsticks to Square (https://leetcode.com/problems/matchsticks-to-square/description/) Problem Statement You have an array, matchsticks, of size n, with ...
monre's user avatar
  • 1
1 vote
1 answer
305 views

I am working on a problem where I need to find values for nodes in a graph of k-nodes. Here an example: The properties are: Each big node (A..H) is connected to at least one blue node Each blue node ...
nowox's user avatar
  • 295
1 vote
1 answer
154 views

In the classic 0-1 knapsack problem, I am using the following (dynamic programming) algorithm to construct a "dp table": ...
slaw's user avatar
  • 111
4 votes
0 answers
57 views

Let $I$ be a set of items; $C \subseteq \mathcal{P}(I)$ be a set of subsets of $I$, where $\mathcal{P}(I)$ stands for the power set of $I$; And $C(i) = \{ c \in C \mid i \in c \}$ be the set of sets, ...
Matheus Diógenes Andrade's user avatar
0 votes
0 answers
99 views

You have board size and one Knight but what is different is that when you move it you have to duplicate the knight and the 2 duplicates have to be in valid position from the knight This gets repeated ...
KnightsProblem's user avatar
3 votes
1 answer
83 views

Say that I have a plasma gun: It's easy to compute the trajectory of the plasma ray starting from the gun. However, another ray may come from afar: As everybody knows, plasma rays are deviated when ...
cdupont's user avatar
  • 131
0 votes
1 answer
98 views

In the slides' based animation given for backtracking, here (with code here, in the web-page ); have few doubts, in the code restated below, and the execution as shown in the call #5. ...
jiten's user avatar
  • 201
2 votes
2 answers
1k views

When dealing with a Recursive Backtracking Algorithm what are the ways to speed it up and what computational hardware is involved? I'm assuming from ignorance that everything is done by the CPU so the ...
Daviid's user avatar
  • 123
1 vote
0 answers
53 views

I'm working on implementing a puzzle board game called Double-Choco published by Nikoli magazine Where the board is a 2-dimensional matrix with cells that are either white or gray. The goal is to ...
Muhammad Z's user avatar
1 vote
1 answer
330 views

With the following recursive code to count leaf nodes of a binary tree, is there any way to make it faster or parallel-computing optimized in time? Python code - (mag(P) = number of leaf nodes of tree ...
Ten's user avatar
  • 119
0 votes
2 answers
103 views

As of recently I've been trying to get better at algorithms and I've stumbled onto one that I can't seem to solve. The idea behind the algorithm is to try to find as many different ways as possible to ...
JohnA's user avatar
  • 101
1 vote
1 answer
353 views

I don't really need hands on coding help, I need to clear my concepts of some of the more complex topics of DS and Algo like NP-Completeness, Computational Geometry, String Matching, Multithreaded ...
azwadkm22's user avatar
0 votes
1 answer
304 views

Problem is to decide if it is possible to partition a given array nums into k partitions. I've written a brute force backtracking algorithm. How do we analyse this algorithm to calculate average ...
Ajax's user avatar
  • 163

15 30 50 per page
1
2 3 4 5
7