Shubham Vora has Published 962 Articles

Split Parenthesis Sequence into maximum valid Substrings

Shubham Vora

Shubham Vora

Updated on 27-Oct-2023 16:07:31

80 Views

In this problem, we need to split the parenthesis string into valid groups. When all opening brackets have related closing brackets, we can say that the group of parenthesis is valid. Problem Statement We have given a string containing open and closed parentheses. We need to split the string ... Read More

Print Words with Prime length from a Sentence

Shubham Vora

Shubham Vora

Updated on 27-Oct-2023 15:24:33

184 Views

In this problem, we need to show all words of the string having the prime length. The logical part of the problem is getting the words from the string and checking whether its length is prime. We can check whether the length of the number is divisible by any ... Read More

Minimum deletion such that XOR of adjacent digits is atmost 1

Shubham Vora

Shubham Vora

Updated on 27-Oct-2023 14:56:08

71 Views

In this problem, we will learn to find the count of minimum deletion required so that when we take the XOR of any two adjacent elements, we should either get 0 or 1. We will use the properties of the XOR operations to solve the problem. For example, when we ... Read More

How to set Parent State from Children Component in ReactJS?

Shubham Vora

Shubham Vora

Updated on 26-Oct-2023 02:29:41

33K+ Views

In ReactJS, we can set the state in the child component by passing the values as a prop of the child component. Sometimes, we require to set the state from the children component to the parent component in ReactJS. We can create a state handler function in the parent component ... Read More

Minimize operations to make String palindrome by incrementing prefix by 1

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 16:10:04

103 Views

In this problem, we will count the number of operations required by increasing the prefix characters of the given string. We will use character difference to count the minimum number of operations required to make string palindromic. Problem Statement We have given a string nums containing the numeric ... Read More

Maximum moves to reach destination character in a cyclic String

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 15:59:58

67 Views

In this problem, we will find the maximum distance from the initial to the final character in the cyclic string. The basic approach to solve the problem is to find the next closest final character for every initial character and update the maximum distance if required. Another approach traverses the ... Read More

Maximize value of Binary String in K steps by performing XOR of Substrings

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 15:11:47

165 Views

In this problem, we will maximize the value of the binary string by performing K XOR operations of substrings of the given binary string. To maximize any binary string, we should maximize the substring starting from the leftmost zero. For example, to maximize the ‘11001’ string, we need to choose ... Read More

Maximize sum by picking Array element to left of each ‘1’ of a Binary String

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 15:03:43

67 Views

In this problem, we will find the maximum sum of array elements by picking up unselected elements at the left from the current 1's index. We can use the vector list and sort() method to solve the problem or priority queue. The priority queue inserts the element in the ... Read More

Maximize “10” Subsequences by replacing at most one 0 with 1

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 14:57:07

60 Views

In this problem, we need to maximize the ‘10’ subsequences in the given binary string by replacing the 0 or 1 ‘0’ character with ‘1’. We can replace each ‘0’ with ‘1’ one after another and find a maximum number of ‘10’ subsequences in the updated string. Problem statement − ... Read More

Make all Strings palindrome by swapping characters from adjacent Strings

Shubham Vora

Shubham Vora

Updated on 23-Oct-2023 14:54:49

360 Views

In this problem, we will make all strings of the given array palindromic by swapping the characters of the adjacent string. To solve the problem, we will try to make the character the same at p and str_len - p - 1 index in all strings, and it is only ... Read More

Advertisements