
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 7197 Articles for C++

147 Views
We are given an integer B and A, and we have to convert the number K from 0 to exactly B by applying the given operations in the minimum steps. We can increase the current number K by 1 i.e. K = K + 1 We can add the product of the number A with any power of 10 to the number K i.e. K = K + A * 10^p, where p is any non-negative number. Sample Examples ... Read More

222 Views
We are given an array it this problem and we have to remove all the elements of the array with the minimum cost required. We have to remove two elements at a time and add them to the total cost. Also, we can remove the third number without any cost if we remove two elements and the third element's value is at most equal to the minimum of them. Also, it is given that the given array will be of a size greater than 1. Sample Examples Input int arr[] = {7, 6, 5, 2, 9, ... Read More

134 Views
We are given an array that contains the binary numbers that are '0', and '1' only. We have to make a one-bit set of the given array which was earlier not the set bit (there will be at least a bit present in the given array which will not be a set bit) to set bit such that the number of indexes present in between the set bits of the final array will be at the maximum distance possible. Sample Examples Input int arr[] = {1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, ... Read More

84 Views
There are two players, X and Y, who are playing a game. X will start the first and can pick 1 stone from the set of an unlimited number of stones after that Y will start and can pick the 2 stones, then X will pick 3, and so on the game will go alternatively until the sum of the total stones picked by X is less than or equal to the given number A or the sum of total stones picked by Y is less than or equal to another given number B. If the current sum of any ... Read More

131 Views
We are given an array of non-negative integers and we have to perform an operation of the given array any number of times possible so that we can choose any element of the array and can choose another element from the array that will be less than or equal to the current element and we will subtract it from the first element. After subtracting we will remove the first element if it becomes zero. After applying the above-described method any number of possible times we have to find the minimum possible element present in the array. ... Read More

115 Views
Peaks are defined as the point or index in the array where are both left and right sides values are smaller than the value of that index. And Troughs are defined as the point or index of the array where are both left and right sides values are greater than the value of that index. In this problem, we have given an array 'array' of size n of integers. Our task is to minimize or reduce the count of peaks and troughs of the given array by performing an operation. Operation is that we can replace at most one value of the ... Read More

152 Views
We are given two strings and we have to check if it is possible to convert the first string to another by performing any number of times a particular given task. The tasks that can be performed on the given first string only and the tasks are: Choose any index i such that i < length(A) -1 and swap ith character with the next character. We are given an integer k and we can choose any consecutive k indexes of the first string only if they are ... Read More
Find Binary String of size at most 3N containing at least 2 given strings of size 2N as subsequences

138 Views
We are given three strings of equal size equal to 2*N, where N is an integer. We have to create a string of the size 3*N and at least two strings from the given strings be the subsequence of it. Also, the given strings are binary strings which means they only contain two different characters '0' and '1'. We will implement a code by traversing over the string and getting the frequency of the zeros and ones. Sample Examples Input string str1 = “11”; string str2 = “10”; string str3 = “10”; Output 110 ... Read More

183 Views
Set bits are the bits in the binary representation of the number which are '1'. The binary representation of the number contains only two digits '1' and '0', also it may be present in the form of a string. We are given a string, the binary representation of a given number, and an integer k. We have to get all the substrings of the length k from the given string and take the bitwise OR of all of them and at last, we have to return the number of the set bits present in the final string. Sample ... Read More

295 Views
In a string, a subsequence is a string that can be formed by deleting some character from it which means it contains some character from the string may be all or none and all will be present in the same order of the string. Among two strings we have to find the longest common subsequence that will not contain any repeating characters. Sample Examples Input string str1 = "aabcadjmuorrrcc" string str2 = "adbcwcadjomrorlc" Output The length of the longest common subsequence is: 8 Explanation: In the above-given strings, we have the largest ... Read More