Shubham Vora has Published 957 Articles

Iterative Method to Find Height of Binary Tree

Shubham Vora

Shubham Vora

Updated on 21-Jul-2023 21:51:02

667 Views

The binary tree is a data structure. Each node of the binary tree contains either 0, 1, or 2 nodes. So, the binary tree can contain multiple levels. Here, we need to write the iterative code using the loops to find the height of the binary tree. The total number ... Read More

How to Efficiently Implement k Queues in a Single Array?

Shubham Vora

Shubham Vora

Updated on 21-Jul-2023 21:47:38

413 Views

In some cases, we need to implement our own data structure for better usability and customization. Here, we need to implement the K Queues using the single array. The first solution that comes to mind is dividing the array into N/K parts and using each part of the array as ... Read More

Sum of numbers formed by consecutive digits present in a given string

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:31:33

490 Views

Problem Statement We have given a string str containing the numeric and alphabetical characters. We need to find the sum of all numbers represented by a continuous sequence of digits available in the given string. Sample Examples Input str = “12were43” Output 55 Explanation The sum of 12 ... Read More

Modify a Sentence By Reversing Order Of Occurrences Of All Palindrome Words

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:27:29

183 Views

Problem Statement We have given a string str containing a total of N words. We need to find all palindrome words in the given string and create a new string by reversing the order of all palindrome words. Sample Examples Input str = ‘nayan was gone to navjivan eye hospital’ ... Read More

Minimum Removals Required To Place All 0s Before 1s In a Binary String

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:25:35

359 Views

Problem Statement We have given binary string str, and we require to remove minimum characters from the string such that we can place all zeros before 1. Sample Examples Input str = ‘00110100111’ Output 3 Explanation Here, we can achieve output 3 in two ways. We can ... Read More

Minimum Number That Can Be Obtained By Applying '+' And '*' Operations On Array Elements

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:16:15

135 Views

Problem Statement We have given an array of length ‘N’ containing some positive integers. Also, we have given the string of length ‘N-1’ containing only ‘*’ and ‘+’ characters, where ‘*’ is a multiplication operator, and ‘+’ is an addition operator. We require to perform the arithmetic operation with array ... Read More

Make a String Non-Palindromic By Inserting a Given Character

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:13:31

167 Views

Problem Statement We have given a string str and character c in the input. We need to insert the given character c in the string at the index so that we can convert the string to non-palindromic. If we can’t convert the string to non-palindrome, print ‘-1’. Sample Examples Input ... Read More

Lexicographically Largest String With Sum Of Characters Equal To N

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:10:57

548 Views

Problem Statement We have given a positive integer num. We need to find the lexicographically largest string of lowercase alphabetical characters such that the sum of all characters of the string is equal to num. Here, ‘a’ = 1, ‘b’ = 2, ‘c’ = 3, ‘d’ = 4, …., ‘z’ ... Read More

Distinct Numbers Obtained By Generating All Permutations Of a Binary String

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:09:11

450 Views

Problem Statement We have given binary string str of length N. We need to find all permutations of the string, convert them to the decimal value, and return all unique decimal values. Sample Examples Input str = ‘1’ Output [1] Explanation All permutations of the ‘1’ is only ... Read More

Count Intervals That Intersects With a Given Meeting Time

Shubham Vora

Shubham Vora

Updated on 18-Jul-2023 17:07:14

123 Views

Problem Statement We have given a two-dimensional array containing the pairs of starting and ending times for time intervals in the 12-hour format. Also, we have given string str in the 12-hour time format. We need to find a total number of intervals which included the time represented by str. ... Read More

Advertisements