Pascal’s Triangle

Problem Statement The logic is in the above gif itself. We have to do the following things.1. Hardcode 1 at 0th and last position of every row.2. If we are at the ith row and jth column. We can get the value of pascal[i][j]. pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j];

BFS daigram

Open the Lock

Problem Statement To be frank, as I read the problem I realized it is a BFS problem. Let’s see what was my thought, we have to count the number of steps to reach the final string, this denotes we have to traverse the intermediate nodes. We cannot directly jump to the final string and apply…


N Queen Problem

Problem Statement: LeetCode May 2021 – Day 22 8 Queen problem is a standard example in the backtracking world. Whenever you start learning the backtracking paradigm this is the first problem you may encounter. So the question is how to solve this problem. For any given problem it is very rare that we directly come…