Word Search : Given a 2D board and a word, search if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell,
where “adjacent” cells are those horizontally … Read More
Recursion
Leetcode: Edit Distance
Given two words word1 and word2, find the edit distance between word1 and word2 i.e. minimum number of operations required to convert word1 to word2.
You have the following 3 operations permitted on … Read More
Print Power Set of a Set
Print Power Set of a Set of character.
Power Set Power set P(S) of a set S is the set of all subsets of S. For example S = {a, b, c} then P(s) =
‘N’ Story Building, with 1,2,3 steps how many ways can a person reach top of building.
A building has n steps. A person can take 1,2 or 3 steps. In how many ways can a person reach top of building.
In order to build logic, lets think from first step
If … Read More
Count number of ways to reach a given score in a game
Consider a game where a player can score 3 or 5 or 10 points in a move. Given a total score n, find number of ways to reach the given score.Examples:
Input: n = 20
… Read More Input: n = 20