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...Discuss·32 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...DiscussLeetcodesudoko-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(...DiscussLeetcodeparameterized 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...DiscussPython

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,...DiscussData 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); ...Discuss2-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...Discuss·10 likes2Articles1Week

Abhilietcode.hashnode.dev·Jun 29, 2024Find All Paths in a MazeYou are given a 2D grid representing a maze where: 'S' represents the starting point, 'E' represents the ending point, '0' represents open paths, and '1' represents walls. You need to find all possible paths from 'S' to 'E' using backtracking. ...DiscussBacktrackingbacktracking

Abhilietcode.hashnode.dev·Jun 27, 2024Subsets IIExplain the Problem Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example: Input: nums = [1,2,2] Output: [ ...DiscussBacktrackingbacktracking

Abhilietcode.hashnode.dev·Jun 27, 2024Palindrome Partitioning IIExplain the Problem Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. Example: Input: s = "aab" Output: 1 Explanation: The palindrome partition...DiscussBacktrackingbacktracking