Find twelve 32-bit numbers such that each pair of them differs by bits in at least 17 positions. I'm struggling to find and optimal algorithm for thi ...
Find twelve 32-bit numbers such that each pair of them differs by bits in at least 17 positions. I'm struggling to find and optimal algorithm for thi ...
I was recently assigned the knight's tour problem. Here is my try at it: I applied recursion and backtracking in this but the code crashes afte ...
This function gives the correct result for some reason even though it shouldn't as nums[j] should be out of bounds. Can someone explain why this wor ...
I want to print number of possible non-empty sequences of letters . Eg. Expected output is But i get the below output which is incorrect. How to ...
I have an input of type tuple. The tuple has an n-length.(e.g. (1,1,2)) I also have a list of n-elements. (e.g. [A, B, C, D]) I need to get all possib ...
I've been working on learning backtracking and I know how the general template goes, but I'm struggling to fully understand how the algorithm backtrac ...
I'm working on the Alphametics puzzle A set of words is written down in the form of an ordinary "long-hand" addition sum, and it is required that ...
I am trying to solve the n-queens problem. I wrote a solution for the problem as follows: The above code uses recursive backtracking to solve the n ...
I'm coding a board game similar to checkers using prolog and I have this function that tests random generated numbers. I want it to return the first i ...
I have a simple array with values [1, 2, 3], and I'd like to find all permutations. I don't understand why moving 'copying' part of the code before th ...
I am finding count of all the ways a target is reached. In base case, i am updating the value but when returning, it is taking the initial value only. ...
I have a text from which I want to extract the first two paragraphs. The text consists of several paragraphs seperated by empty lines. The paragraphs ...
I'm trying to implement a sudoku-like puzzle solver that involves groups in prolog, and where one of the rules is that the same value cannot be repeat ...
Given the leetcode question 1416. Restore The Array: A program was supposed to print an array of integers. The program forgot to print whitespaces ...
If someone can test this and find the problem that would be very helpful. The algorithm solves the puzzles but has some zeros in the solution which is ...
I implemented the 0/1 knapsack problem with the backtracking technique, but I didn't get the expected result. capacity : total knapsack capacity ...
I am at the verge of loosing my mind over trying to fix an Email Regex i built: It is almost perfect for what i need. It works in 99.9% of all cases. ...
I have a code to solve a Sudoku recursively and print out the one solution it founds. But i would like to find the number of multiple solutions. How w ...
I have the following problem, but I can't find a good approach. There are n stacks and p types of items (1 < p < n). Each type has exactly 4 it ...
I need to solve a maze using backtracking method. My maze has 0 listed as a wall, 1 listed as an empty cell, 2 is for visited, 3 for dragon. Dragons a ...