In the previous article, we learned the solution for the problem of “Matrix chain multiplication”. We had discussed the recursive
Continue readingCategory: Arrays
Number of Distinct Islands
Problem Statement: Given a boolean 2D matrix grid of size N x M. You have to find the number of
Continue readingNumber of Longest Increasing Subsequences | (DP-47)
Problem Statement: Number of Longest Increasing Subsequences Prerequisite: Longest increasing subsequence, Printing Longest Increasing subsequence Problem Link: Given an array,
Continue readingLongest Bitonic Subsequence | (DP-46)
Problem Statement: Longest Bitonic Subsequence Prerequisite: Longest increasing subsequence, Printing Longest Increasing subsequence Problem Link: Given an array, ‘Arr’ of
Continue readingProduct of Array Except Itself
Problem Statement: Given an array arr[] of integers, you need to return the product of given array elements except including
Continue readingDetect Cycle in an Undirected Graph (using DFS)
Problem Statement: Given an undirected graph with V vertices and E edges, check whether it contains any cycle or not.
Continue readingDetect Cycle in an Undirected Graph (using BFS)
Problem Statement: Given an undirected graph with V vertices and E edges, check whether it contains any cycle or not.
Continue readingPassing 2D arrays as arguments in CPP
Ways to pass a 2D array to a function are as follows:- When both dimensions are available globally. Code: Output:
Continue readingCounting Bits
Problem statement : Given an integer n, return an array ans whose length is n+1 such that for each i (0
Continue readingInsert New Interval
Problem Statement: You are given an array of non-overlapping intervals where intervals[i] = [start, end] represent the start and the
Continue reading