Shubham Vora has Published 962 Articles

Check if cells numbered 1 to K in a grid can be connected after removal of atmost one blocked cell

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 15:52:11

39 Views

In this problem, we will check whether we can connect all K cells by unblocking any single cell. To solve the problem, we will assume all connected K as a single Island. If any single blocked cell can connect all Island of the matrix, it is only possible to connect ... Read More

Minimum Number of Insertions in given String to Remove Adjacent Duplicates

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 15:49:58

62 Views

In this problem, we will count the minimum number of characters we need to insert to remove all adjacent duplicate characters. To solve the problem, we need to count the total number of adjacent duplicate character pairs. Problem statement – We have given a string named str containing N ... Read More

Boundary Level order traversal of a Binary Tree

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 15:49:41

109 Views

In this problem, we will traverse each boundary of the given binary tree in the given order. We will use the recursive approach to traverse each boundary of the binary tree one by one. However, we will also learn the iterative approach using a stack to traverse the binary tree's ... Read More

Minimum Jumps from Either End to Reach Largest and Smallest Character in given String

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 15:43:26

66 Views

In this problem, we require to find the minimum jumps required to make to reach the largest and smallest character in the given string. We can move to the next or previous character in one jump. We can solve the problem by finding the position of the lexicographically largest and ... Read More

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 15:38:41

79 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, ... Read More

Javascript Program to Minimize Characters to be Changed to make the Left and Right Rotation of a String Same

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 15:31:37

65 Views

In this problem, we require to determine the minimal cost to make the string’s left and right rotation same. Here is the observation which we will use to solve the problem. All characters should be equal for strings with odd lengths to make the left and right rotations ... Read More

Java Program to Minimize Characters to be changed to make the Left and Right Rotation of a String Same

Shubham Vora

Shubham Vora

Updated on 25-Aug-2023 15:24:18

76 Views

In this problem, we need to change the minimum characters in the given string to make its left and right rotations the same. In the string, we can observe that we can only make the left and right rotations of the string same if the string has an odd length ... 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 15:22:27

76 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 ... Read More

Java Program to Implement Unrolled Linked List

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 18:10:04

105 Views

In this problem, we will learn to implement the unrolled linked list. The unrolled linked list is a specialized version of the linked list. The normal linked list contains a single element in a single node, but the unrolled linked list contains a group of elements in each node. ... Read More

Java Program to Implement the Vizing's Theorem

Shubham Vora

Shubham Vora

Updated on 24-Aug-2023 18:07:17

55 Views

In this problem, we need to implement Vizing's Theorem. Vizing's Theorem is used with graphs. Theorem statement - For any undirected graph G, the value of the Chromatic index is equal to the d or d + 1, where d is the maximum degree of the graph. ... Read More

Advertisements