
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 1860 Articles for Data Structure

200 Views
In this problem, we will count the maximum number of 10 and 01 pairs that can be formed using the given binary string. To solve the problem, we can check the number of 10 and 01 pairs we can form using adjacent characters without sharing any characters in two pairs. Problem Statement We have given a bin_str binary string. We need to count the maximum number of 10 and 01 pairs we can make using the adjacent characters only. Also, we can use one character in any single pair. Two pairs can't share a single character. Sample Examples Input ... Read More

119 Views
In this problem, we will find the index value for each pair such that the resultant pair's average value is just greater than the current pair's average value. To solve the problem, we will use the sorting algorithm and binary search technique. We will use a sorting algorithm to sort the array based on the pair's average value and a binary search algorithm to search a pair with a greater average value from the sorted array. Problem Statement We have given a pairs[] array containing the N pairs of positive integers. It is also given that the first element of ... Read More

125 Views
In this problem, we will count the number of unique strings we can generate by replacing each vowel with the closest consonant and each consonant with the closest vowel. We can find the number of choices for each character of the string to replace the current character with other characters. After that, we can multiply the number of choices of each character to get the answer. Problem Statement We have given an alpha string. We need to count the total number of different strings we can generate from the given string by performing the below operations on each character of ... Read More

263 Views
Keywords are important in any programming language, as they are reserved words with a particular predefined meaning. The keywords are used to define the variables, function, and class, change the program's control flow, traverse the list, etc. When we talk about the 'String', it is a fundamental data type to represent a series of characters. Some programming languages refer to the 'String' as a class, and some programming languages refer to the 'String' as a keyword. In this tutorial, we will explore the use of the 'String' word in the programming language. C/C++ The C or C++ programming languages are ... Read More

106 Views
In this article, we will learn about Mex and will also generate the C++ code that returns the kth index of the series so formed by using append and MEX (>0) operations on the given sequence. The roadmap of the operations to be performed is given below − Start with a sequence containing only the number 1 i.e, [1]. Now, we need to perform (n-1) steps − In each step, we append the current series by itself. For example, if the existing series is [1, 2, 3], after appending, it becomes [1, 2, 3, 1, 2, 3]. Now, find ... Read More

321 Views
This this article, we will discuss the different approaches to calculate the sum of the given series. Problem Statement We are given a number and our task is to calculate the sum of the series Σ (n / i) for I =0 to i=n. We are given any given value of n where n can be any number less than 10^12 considering on integer division. For example, if the given input is 10, The sum of given series can be written as (10/1) + (10/2) + (10/3) + (10/4) + (10/5) + (10/6) + (10/7) + (10/8) + ... Read More

307 Views
In this article, we will discuss what is meant by stable sorting and how can we sort an array in descending order keeping in mind that the sorting algorithm should be stable. Let us first discuss about what are the features of a stable sort algorithm − A sorting algorithm is called stable if it keeps the original order of items with the same value in the input data when they are sorted. So, if there are two or more items with the same value, a stable sorting algorithm will not change their relative positions in the sorted output. Stable ... Read More

186 Views
In this article, we will discuss two approaches to solve the problem - Ropes left after every removal of smallest rope. Problem Statement We are given an array of elements where array [i] denotes the length of the ith rope in the array. Our task is to cut a length equal to the smallest element of the array from all the elements of the array until we have all the elements length equal to zero. We have to output the number of ropes with non-zero lengths after each cut operation. Let us consider an example for the same − Let ... Read More

165 Views
In this article, we will discuss two approaches to generate the desired sum. Both the approaches are dynamic programming-based approaches. In the first approach, we will memorization for dynamic programming and then we will apply the same approach for tabulation in order to avoid the use of extra stack space for recursion. Problem Statement We are given a list of n integers, and our goal is to minimize the sum of multiplications by repeatedly taking two adjacent numbers, summing them modulo 100, and replacing them in the list until only one number remains. Let's consider the input [30, 40, 50] ... Read More

277 Views
In this article, we will work upon sorting an array in decreasing order by applying some subtraction operations on it. Problem Statement We are given an array containing a series of n numbers from array[0], array[1], . . . . , array[ n-1 ]. We are also given an integer nums. Our task is to generate a decreasing array by subtracting nums from the array elements in every operation. We need to return the least possible number of such operations required in order to make the array decreasing in order. Let us understand the problem with an example − ... Read More