Prabhdeep Singh has Published 197 Articles

Minimum cost for constructing the subsequence of length K from given string S

Prabhdeep Singh

Prabhdeep Singh

Updated on 17-May-2023 14:39:01

140 Views

We will be given a string of length n, an integer k, and an integer array of length 26. The integer array defines the cost of each lowercase character and the string will contain only lowercase letters. We have to create a subsequence of length k from the given string ... Read More

Find an N-length Binary String having maximum sum of elements from given ranges

Prabhdeep Singh

Prabhdeep Singh

Updated on 17-May-2023 14:36:19

120 Views

We will be given an array that will contain the pairs which represent the range and their value will range from 0(inclusive) to N(exclusive). Here, N is the size of the binary string which we have to return as the answer. For all the given ranges we have to maximize ... Read More

Sort an array by swapping adjacent elements from indices that contains ‘1’ in a given string

Prabhdeep Singh

Prabhdeep Singh

Updated on 17-May-2023 14:33:57

272 Views

Sorting an array means ordering all the elements of the array in increasing order. Sorting an array by swapping adjacent elements means we can only swap elements that are adjacent to each other but we can swap adjacent elements any number of times. We will be given a binary string ... Read More

Minimum number of flipping adjacent bits required to make given Binary Strings equal

Prabhdeep Singh

Prabhdeep Singh

Updated on 17-May-2023 14:30:48

276 Views

A binary string is a string that contains only two different types of characters 0 and 1. We will be given two binary strings of the same length and our task is to make both of them equal by toggling two adjacent characters of the first string. Also, we have ... Read More

Max count of N using digits of M such that 2 and 5, and, 6 and 9 can be treated as same respectively

Prabhdeep Singh

Prabhdeep Singh

Updated on 16-May-2023 13:52:56

80 Views

Max count is a count which is the maximum possible. Here we have given an integer N and a string of integer M. Our task is to return the maximum count of making the number N using the digits of the string of integer M. Also given that, we can ... Read More

Find the smallest number formed by inserting a given digit

Prabhdeep Singh

Prabhdeep Singh

Updated on 16-May-2023 13:50:26

174 Views

Inserting a number in the given number means adding a new given digit in the given number either at the front, end, or in between the numbers. We have given a number and a digit and have to add the digit in the number in a way such that the ... Read More

Maximize the missing values in a given time in HH:MM format

Prabhdeep Singh

Prabhdeep Singh

Updated on 16-May-2023 13:46:32

71 Views

A string will be given to us of length five which represents the time in the HH:MM format. There may be some ‘?’ present in the string and we have to replace them with any number such that the result is the valid time which could be the maximum possible. ... Read More

Generate all possible strings formed by replacing letters with given respective symbols

Prabhdeep Singh

Prabhdeep Singh

Updated on 16-May-2023 13:41:10

160 Views

Generating all possible strings is to replace a character of a string with a respective symbol and produce all possible strings. We will be given a string ‘s’ of size ‘N’ and an unordered map ‘mp’ of a pair of characters of size ‘M’. Here we can replace the mp[i][0] ... Read More

Find Binary string by converting all 01 or 10 to 11 after M iterations

Prabhdeep Singh

Prabhdeep Singh

Updated on 16-May-2023 13:38:01

118 Views

A binary string is a string that consists of only two different types of characters and that is ‘0’ and ‘1’. We will be given a binary string and the number m. We have to apply the operation to convert all the consecutive occurrences of the 0 and 1 that ... Read More

Fibbinary Numbers (No consecutive 1s in binary) – O(1) Approach

Prabhdeep Singh

Prabhdeep Singh

Updated on 16-May-2023 13:35:03

211 Views

Fibbinary Numbers are numbers that have no consecutive 1s in their binary representation. However, they can have consecutive zeros in their binary representation. Binary representation is the representation in which the numbers are shown with base 2 and only two digits that are 1 and 0 only. Here, we will ... Read More

Previous 1 ... 7 8 9 10 11 ... 20 Next
Advertisements