PROBLEM DESCRIPTION Given a number N. The task is to check whether it is sparse or not. A number is said to be a sparse number if no two or more consecutive bits are set in the binary representati...
Bit Difference (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION You are given two numbers A and B. The task is to count the number of bits needed to be flipped to convert A to B. geeksforgeeks SOLUTION class Solution { public static...
N-Queen Problem (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION The n-queens puzzle is the problem of placing n queens on a (n×n) chessboard such that no two queens can attack each other. Given an integer n, find all distinct solutions to t...
Rat in a Maze Problem - I (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Consider a rat placed at (0, 0) in a square matrix mat of order n* n. It has to reach the destination at (n - 1, n - 1). Find all possible paths that the rat can take to reach ...
Special Keyboard (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Imagine you have a special keyboard with the following keys: Key 1: Prints ‘A’ on screen Key 2: (Ctrl-A): Select screen Key 3: (Ctrl-C): Copy selection to buffer Key ...
Word Boggle (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a dictionary of distinct words and an M x N board where every cell has one character. Find all possible words from the dictionary that can be formed by a sequence of adja...
Tower Of Hanoi (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION The tower of Hanoi is a famous puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod. You are given the number of ...
Level order traversal in spiral form (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a binary tree and the task is to find the spiral order traversal of the tree. Spiral order Traversal mean: Starting from level 0 for root node, for all the even levels w...
Edit Distance (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given two strings str1 and str2. Return the minimum number of operations required to convert str1 to str2. The possible operations are permitted: Insert a character at any ...
Rearrange characters (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a string S with repeated characters. The task is to rearrange characters in a string such that no two adjacent characters are the same. Note: The string has only lowercas...