Arka Infotecharkainfotech.hashnode.dev·Jan 10, 2025Understanding Backtracking with ExamplesIntroduction Backtracking is a powerful algorithmic technique used for solving problems that involve making a series of decisions and exploring all possible solutions. It’s particularly useful for solving combinatorial problems, such as finding all p...CombinatorialProblems
Nachiketcodewithnachiket.hashnode.dev·Jan 3, 2025Backtracking: Mazes, NQueens, and NKnightsBacktracking is a fascinating and versatile algorithmic technique. It involves exploring all potential solutions to a problem by recursively attempting to build a solution one step at a time while removing the previous step if it doesn't lead to a va...10 likesDSA
Tapan Rachchhtapanrachchh.hashnode.dev·Oct 30, 20242684. Maximum Number of Moves in a Gridclass Solution: def maxMoves(self, grid: List[List[int]]) -> int: ans = 0 def traverse(a, b, prevVal): nonlocal count, ans if (a, b) in visited: return visited.add((a, b)) ...Python
Shanmukhablog.memsranga.com·Sep 7, 2024Solving LinkedIn Queens Game using backtrackingAs a weekend project I thought of solving LinkedIn’s Queens game programmatically. (Well idea was to make it solve using ChatGPT, but too many un-knows and thought of solving using classic, vanilla backtracking) For those of you who haven't played (o...186 readsLinkedIn Queens
Chetan Dattachetan77.hashnode.dev·Sep 2, 2024Sudoko SolverProblem Write a program to solve a Sudoku puzzle by filling the empty cells. (link) A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 must occur exactly once in each row. Each of the digits 1-9 must occur exactly onc...Leetcodesudoko-solver
Chetan Dattachetan77.hashnode.dev·Aug 25, 2024RecursionIntroduction Recursion When a function calls itself until a specified condition is met. f(){ print(1); f(); } Stack Space Base Case The condition that stops the recursion is called the base case. //cnt is a global variable f(){ if(...Leetcodeparameterized recursion
Tapan Rachchhtapanrachchh.hashnode.dev·Aug 13, 202440. Combination Sum IIclass Solution: def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]: candidates.sort() N = len(candidates) ans = set() def checker(currentSum, nextIndex, nums): if currentS...Python
Nadim Anwarblog.nadim.in·Jul 14, 2024Data Structures for Beginners: Essential Concepts SimplifiedWhat is Data Structure? A data structure is a way of organizing data so that it can be used effectively and efficiently. From a code design perspective, we need to pay particular attention to the way data is structured. If data isn’t stored properly,...Data Structures and Algorithms (DSA)#nadim.in
Anower Hossainanower77.hashnode.dev·Jul 7, 2024Recursion & Backtracking1-Recursion-Basic #include "bits/stdc++.h" using namespace std; void solve(int n) { if(n==0) return; solve(n-1); cout<< n << " "; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; solve(n); ...2-Tree-Recursion
Animesh Kumaranimeshk.hashnode.dev·Jul 1, 2024Backtracking: The Hidden Gem of Problem-SolvingBacktracking is a powerful and often underrated technique in computer science. It's like a problem-solving Swiss Army knife that can help you find solutions to complex problems efficiently. In this blog, we'll explore what backtracking is, how it wor...10 likes2Articles1Week