Articles on Trending Technologies

Technical articles with clear explanations and examples

Length of Smallest Substring to be Replaced to make Frequency of each Character as N/3

Shubham Vora
Shubham Vora
Updated on 25-Aug-2023 253 Views

In this problem, we need to find the smallest substring so that we can replace its character and make the frequency of each character equal to the N/3 in the given string. We can use the sliding window technique to solve the problem. We can find the minimum window size, which contains all excess characters, that will be the answer to the problem. Problem statement – We have given a string alpha. The size of the alpha is N which is always divisible by 3. The given task is to find the minimum length of the substring so that we ...

Read More

Minimum number of moves to make M and N equal by repeatedly adding any divisor of number to itself except 1 and the number

Pranavnath
Pranavnath
Updated on 25-Aug-2023 212 Views

Introduction The problem of finding the minimum number of moves to make two given numbers M and N rise by repeatedly including any divisor of a number (except 1 and the number itself) can be approached without utilizing Dynamic Programming. In this issue, we are required to plan methodologies that minimize the number of moves required to attain the specified uniformity. Two approaches are displayed to handle this issue: Greedy Algorithm, Prime Factorization. These approaches utilize distinctive strategies to recognize common divisors and optimize the method of making the numbers rise to investigate these non-Dynamic Programming approaches, we will pick up ...

Read More

Number of distinct Shortest Paths from Node 1 to N in a Weighted and Directed Graph

Pranavnath
Pranavnath
Updated on 25-Aug-2023 283 Views

Introduction The issue at hand is to determine the number of distinct shortest ways from Node 1 to Node N in a weighted and directed graph. We are given a graph representation comprising of nodes and edges, where each edge encompasses a weight related with it. Our objective is to create an algorithm that can effectively calculate the count of particular shortest ways, taking into consideration the weighted nature of the graph. For this issue, we have presented three diverse approaches to decide the number of particular shortest ways. The primary approach utilizes a Depth-First Search (DFS) algorithm, the second ...

Read More

Count of graphs formed by changing color of any red-colored node with black parent to black

Pranavnath
Pranavnath
Updated on 25-Aug-2023 180 Views

Introduction In graph theory, nodes and edges form the fundamental units of connected structures. They are widely used to represent a broad range of relationships and connections between different entities. In this article, we will dive into an interesting problem involving counting graphs formed by changing the color of red-colored nodes with black parent nodes in C++. We will explain the concept behind graph coloring, introduce an algorithmic approach to solve this problem, and provide a detailed C++ code implementation that we can use. Count of graphs formed by changing color Graph coloring is a concept that involves assigning colors ...

Read More

Find the array to which each element in given queries belong along with count of elements

Pranavnath
Pranavnath
Updated on 25-Aug-2023 195 Views

Introduction In the world of programming, arrays play a fundamental role and are extensively used in various applications. Often, while working with large arrays, we come across situations where we need to determine to which array each element in each set of queries belongs. In this article, we will explore an efficient approach using C++ to find the corresponding array for each query along with the count of elements. The task at hand is to identify which array each query element belongs to and generate a count for those specific arrays. Find the array to which each element in given ...

Read More

Construct a Prime Binary Tree from given non-cyclic graph of N indices

Pranavnath
Pranavnath
Updated on 25-Aug-2023 235 Views

Introduction In the area of programming and data structures, binary trees are widely used to store and retrieve data efficiently. In this article, we will explore the concept of constructing a prime binary tree from a given non-cyclic graph consisting of N indices using C++ code. The Binary tree can be constructed from the non-cyclic graph and the types of this graph are tree, directed acyclic graph and some more. A prime tree comes under the division of binary tree which returns the prime number by appending the two consecutive edges of the graph. Construct a Prime Binary Tree from ...

Read More

Java Program to Find Maximum number of 0s placed consecutively at the start and end in any rotation of a Binary String

Shubham Vora
Shubham Vora
Updated on 25-Aug-2023 322 Views

In this problem, we will write Java code to find the maximum sum of consecutive zeros at the start and end of any string rotation. First, we will use a naïve approach to solve the problem, which generates all rotations of the binary string and counts the starting and ending consecutive zeros. After that, we will learn an optimized algorithm that counts the maximum consecutive zeros. Problem statement – Here, we have a string of size N containing only 0 and 1 characters. We need to find the maximum sum of consecutive zeros at the start and end of any ...

Read More

Difference between the shortest and second shortest path in an Unweighted Bidirectional Graph

Pranavnath
Pranavnath
Updated on 25-Aug-2023 344 Views

Introduction In the area of graph theory, unweighted bidirectional graphs form a fundamental framework for modeling various real-world scenarios. These graphs allow us to explore relationships between different entities, such as road networks or social connections. One key aspect that captures our attention is finding paths between two nodes and determining their respective lengths. In this article, we dive into one interesting facet of this topic – understanding the distinction between the shortest path and second shortest path in an unweighted bidirectional graph. Shortest and second shortest path Unweighted bidirectional (or undirected) graphs consist of vertices or nodes connected by ...

Read More

Count of distinct groups of strings formed after performing equivalent operation

Pranavnath
Pranavnath
Updated on 25-Aug-2023 191 Views

Introduction In computer programming, solving problems often requires us to manipulate strings effectively while accounting for their diversity. One interesting challenge is to determine the count of distinct groups that can be formed after performing equivalent operations on a given set of strings. In this article, we will explore an efficient approach using C++ code to tackle this problem and unlock new possibilities. By employing key algorithmic steps such as group identification, formation, and computation, programmers can effectively tackle challenges related to manipulating diverse sets of strings while maintaining their unique properties. Count of distinct groups of strings formed after ...

Read More

How to Only Allow Changes to Certain Cells in Excel?

Pradeep Kumar
Pradeep Kumar
Updated on 25-Aug-2023 10K+ Views

With the help of Excel, you can effectively organise and analyse data. To protect the integrity of your data and avoid unintentional changes, you might occasionally want to limit editing to only certain cells in your spreadsheet. In this article, we'll look at a number of approaches to completing this work, giving you the power to decide which cells can be changed by you or others while still making the remainder of the spreadsheet accessible. Regardless of your level of Excel proficiency, this lesson will give you step-by-step instructions and insightful advice to help you protect your data and streamline ...

Read More
Showing 34141–34150 of 61,297 articles
Advertisements