Sudhir sharma has Published 1149 Articles

Find maximum path length in a binary matrix in Python

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 05:53:41

296 Views

In this problem, we are given a square matrix mat[][] of size m X n with each element either 0 or 1. If an element has value 1, this means it is connected, if the value is 0, this means it is not-connected. Our task is to find the maximum ... Read More

Find maximum of minimum for every window size in a given array in C++

sudhir sharma

sudhir sharma

Updated on 12-Mar-2021 05:49:21

960 Views

In this problem, we are given an array arr[] of size n. Our task is to Find the maximum of the minimum for every window size in a given array.Problem Description − We need to find the maximum of the minimum of a window size that varies from 1 to ... Read More

Find Maximum number possible by doing at-most K swaps in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 05:08:36

683 Views

In this problem, we are given two integer values n and k. Our task is to find the Maximum number possible by doing at-most K swaps. Problem description: Here, we need to calculate the number which is maximum and created after swapping at-most k digits of the number.Let’s take an example to ... Read More

Find maximum level sum in Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 05:08:07

189 Views

In this problem, we are given  a binary Tree with positive and negative values. Our task is to Find maximum level sum in Binary Tree. Problem Description: We have a binary tree, we will find the sum of all levels in the binary tree and then return the maximum of them.Let’s take ... Read More

Prime Factorization using Sieve O(log n) for multiple queries in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 05:07:35

2K+ Views

In this problem, we need to create a program to calculate Prime Factorization using Sieve O(log n) for multiple queries. As the general method takes O(sqrt(n) ) time which will increase the time required to a huge extent from multiple queries.Let’s recap first, Prime factorization of a number includes ONLY the ... Read More

Principles of Risk Management and Paradigm in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 05:03:15

737 Views

Risk Management is the approach that is used to manage all available resources and make the best use of the resources available in the system.The project manager will analyse risks from all categories and there might be some risks in the working of the project in the runtime environment.Principles of Risk ManagementThere ... Read More

Print a number as string of 'A' and 'B' in lexicographic order in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 05:00:50

145 Views

In this problem, we are given a number N. Our task is to create a program to Print a number as string of ’A’ and ‘B’ in lexicographic order. Representation of all numbers as string of ‘A’ and ‘B’ is1 = A 2 = B 3 = AA 4 = AB 5 = BA 6 = ... Read More

Print all longest common sub-sequences in lexicographical order in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 05:00:17

1K+ Views

In this problem, we are given two string str1 and str2. Our task is to create a program to Print all longest common subsequences in lexicographical order. Let’s take an example to understand the problem,  Input: str1 = “gfare” ,  str2 = “rfare”Output: fareSolution ApproachIn this problem, we will find all possible longest ... Read More

Sum of the series 1 + (1+3) + (1+3+5) + (1+3+5+7) + ...... + (1+3+5+7+...+(2n-1)) in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 04:59:42

580 Views

In this problem, we are given a number n. Our task is to create a program to find the sum of series 1 + (1+3) + (1+3+5) + (1+3+5+7) + …… + (1+3+5+7+…+(2n-1)). Let’s take an example to understand the problem,  Input:   n = 5Output:  55So, according to the question ... Read More

Sum over Subsets - Dynamic Programming in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2021 04:59:09

327 Views

In this problem, we are given an array arr[] of size 2n. Our task is to create a program to find the sum over subset using dynamic programming to solve it.We need to calculate function, F(x) = Σ Ai such that x&i == i for all x. i.e. i is ... Read More

Advertisements