
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

447 Views
Lexicographically smallest string means among the set of strings is the string which appears first in the dictionary order is known as a lexicographically smallest string. We will be given a binary string (that contains only two different types of characters 0 and 1) and we can delete character ‘1’ from any substring ‘10’ from the given string at any number or time. We have to create the lexicographic string by applying this method. Sample Examples Input 1 string str = “1101010011” Output: 000011 Explanation − As we can only remove the character ‘1’ so will remove all the ones ... Read More

257 Views
Regular Bracket Sequence means a string that contains the parentheses of both opening and closing types and results in properly closed brackets. The given sequence may be properly symmetrical and maybe not. In this problem, we are given a list of string that contains the bracket sequences and we have to find the number of pairs that can be concatenated to a single regular bracket sequence. Sample Examples Input 1 string arr[] = {“)()”, “()(“, “()()”, “(())”} Output: 2 Explanation − For the first and second strings we can concatenate the first string after the second string resulting in the ... Read More

330 Views
A binary string is a string that only contains the zeroes and ones as the different characters in them. We are given a binary string and an array of a given length that will contain the pairs. Each pair defines the range, and in that range, we have to return the maximum number of zeros lying between two ones. We will implement two approaches one is the naive approach and another is the efficient approach. Let’s understand with the help of example Input String str = ‘1011010110’ Array Q[][] = {{0, 2}, {2, 5}, {0, 9}} Output: 1 1 3 ... Read More

257 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 at the minimum possible cost. We will use sorting to solve the problem and will implement a code with a full explanation. Sample Examples Input 1 Given string: acbcbac Given number: 4 Given array: {2, 3, 1, 2, 4, 5, 5, 6, 6, 2, 1, 0, 4, 3, 5, ... Read More

227 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 the sum of the product of the frequencies of zero and one. We will implement two approaches one is the naive approach by finding all the strings and another is the efficient solution. Sample Examples Input 1 Given array: {{1, 3}, {2, 4}, {2, 5}} Length of string: 6 Output ... Read More

485 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 that will contain only two types of characters ‘0’ and ‘1’. If any character is ‘0’ in the given string then we cannot swap the element present at that index of the array with adjacent elements. Sample Examples Input 1 Given array: {1, 4, 3, 2, 5, 7, 6} Given ... Read More

463 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 to do this in a minimum number of operations as possible. If it is not possible to convert the first string to the second string then return -1. Sample Example Input 1 string1: 101001 string 2: 100110 Output: 2 Explanation − We can toggle the second index character and the ... Read More

439 Views
In programming array is a data structure, which is used to store collection of homogeneous data elements. And each element in the array is identified by an index value or key. Arrays in Python Python doesn’t have a built-in data structure to represent arrays, but it has a built-in array module for arrays. And also we can use the NumPy package to work with arrays in python. An array defined by the array module is − array('i', [1, 2, 3, 4]) A Numpy array defined by the NumPy module is − array([1, 2, 3, 4]) Also, we can ... 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

221 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 be treated 2 and 5, and, 6 and 9 can be same respectively. Sample Examples Input 1 N = 29 M = "2569783" Output 1: 2 Explanation − As 5 is the same as 2 and 6 is the same as 9 so we have a total of two ... Read More

374 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 resultant new number will be minimum as possible. We will convert the number into a string to make the work of insertion easy. Also, the given number can be negative also so we have to consider this case. Sample Examples Input1 Given number: 124 Given digit: 3 Output: 1234 ... Read More