Find the shortest path in a maze
Given a maze in the form of the binary rectangular matrix, find the shortest path’s length in a maze from a given source to a given destination.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a maze in the form of the binary rectangular matrix, find the shortest path’s length in a maze from a given source to a given destination.
We are given a set of bipolar magnets, each domino-shaped. The objective is to place magnets on an M × N board, which satisfies a set of conditions where both M and N are not odd.
Given a chessboard, print all sequences of moves of a knight on a chessboard such that the knight visits every square only once.
The N–queens puzzle is the problem of placing N chess queens on an N × N chessboard so that no two queens threaten each other. Thus, the solution requires that no two queens share the same row, column, or diagonal.
Write a program to calculate the nth Fibonacci number where n is a given positive number. Fibonacci’s sequence is characterized by the fact that every number after the first two is the sum of the two preceding ones.
Given a set S, generate all subsets of it, i.e., find the power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.
Given an array representing a max-heap, in-place convert it into the min-heap in linear time.
Given an integer array, check if it represents min-heap or not. For example, the first array represents a min-heap, but the second array doesn’t violate the heap property.
Heapsort is an in-place, comparison-based sorting algorithm and can be thought of as an improved selection sort as it divides the input into a sorted and an unsorted region.
Given an array of positive integers, which can be partitioned into three disjoint subsets having the same sum, print the partitions.
Write a program to determine if a given string is palindrome or not. A palindromic string is a string that remains the same with its characters reversed.
In previous post, we have introduced the heap data structure and covered heapify-up, push, heapify-down and pop operations. This article covers C++ implementation of Priority Queue Data Structure (Max Heap and Min heap).