
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++

1K+ Views
Suppose we have one list of data with positive and negative values. We have to find the sum of contiguous subarray whose sum is largest. Suppose the list is containing {-2, -5, 6, -2, -3, 1, 5, -6}, then the sum of maximum subarray is 7. It is the sum of {6, -2, -3, 1, 5}We will solve this problem by using the Divide and Conquer method. The steps will look like below −Steps −Divide the array into two partsFind the maximum of the following threeMaximum subarray sum of left subarrayMaximum subarray sum of right subarrayMaximum subarray sum such that subarray ... Read More

156 Views
Here we will see one interesting problem. let us consider we have three integers A, B, and C. We have to find one minimum integer X, such that X mod C = 0, and X is not in the range [A, B]. If the values of A, B and C are 5, 10 and 4 respectively, then the value of X will be 4. We have to follow these steps to get the solution −Steps −If C is not in the range [A, B], then return C as a resultOtherwise get the first multiple of C, which is greater than ... Read More

365 Views
Suppose we have an array A. We have to find the maximum length of the subarray, whose LCM is the same as the product of the elements of that subarray. If that kind of subarray is not found, then return -1. Suppose array is {6, 10, 21}, then the length is 2, as the subarray {10, 21} is there, whose LCM is 210, and the product is also 210.The approach is straight forward. We have to check every possible subarray of length greater or equals to 2. If the subarray is satisfying the condition, then update the answer as a ... Read More

194 Views
Suppose we two integers N and P. The P is the product of N unknown integers. We have to find the maximum possible GCD of those integers. Suppose N = 3, and P = 24, then different groups will be like {1, 1, 24}, {1, 2, 12}, {1, 3, 8}, {1, 4, 6}, {2, 2, 6}, {2, 3, 4}. The GCDs are: 1, 1, 1, 1, 2, 1. So answer is 2 here.We will find all prime factors of P, and store them into hashmap. The N integers will have max GCD when the prime factor will be common in ... Read More

4K+ Views
Given with ‘a’(first term), ‘d’(common difference) and ‘n’ (number of values in a string) and the task is to generate the series and thereby calculating their sum.What is an Arithmetic seriesArithmetic series is the sequence of numbers with common difference where the first term of a series is fixed which is ‘a’ and the common difference between them is ‘d’.It is represented as −a, a + d, a + 2d, a + 3d, . . .ExampleInput-: a = 1.5, d = 0.5, n=10 Output-: sum of series A.P is : 37.5 Input : a = 2.5, d = 1.5, n ... Read More

280 Views
Given with the rate of filling the tank, height of a tank and radius of a tank and the task is to check whether the tank is overflow, underflow and filled in given time.ExampleInput-: radius = 2, height = 5, rate = 10 Output-: tank overflow Input-: radius = 5, height = 10, rate = 10 Output-: tank undeflowApproach used below is as follows −Input the rate of filling time, height and radius of a tankCalculate the volume of a tank to find the original rate of flow of water.Check for the conditions to determine the resultIf expected < original ... Read More

43K+ Views
Given with an input by the user and the task is to check whether the given input is an integer or a string. Integer can be any combination of digits between 0 -9 and string can be any combination excluding 0 – 9. Example Input-: 123 Output-: 123 is an integer Input-: Tutorials Point Output-: Tutorials Point is a string Approach used below is as follows − Input the data. Apply isdigit() function that checks whether a given input is numeric character or not. This function takes single argument as an integer and also returns ... Read More

1K+ Views
Given with an input of string and the task is to check whether the first and last characters of given string is equal or not.ExampleInput-: study Output-: not equal As the starting character is ‘s’ and the end character of a string is ‘y’ Input-: nitin Output-: yes it have first and last equal characters As the starting character is ‘n’ and the end character of a string is ‘n’Approach used below is as follows −Input the string and store in an array of strings.Calculate the length of a string using length() functionCheck first and last element of ... Read More

252 Views
Given a n number of vertices of a graph, the task is to calculate the edge cover of the graph. Edge cover is to find the minimum number of edges required to cover every vertex of the graph.Like we have n = 5Then its graph will be like −So its edge cover is 3Let’s take another example where the n is 8And its edge cover will be:4ExampleInput: n= 5 Output: 3 Input: n= 8 Output: 4Approach used below is as follows −Take the input from the userFind the ceiling value of the result of number of vertices by dividing it ... Read More

4K+ Views
Given with the cost price(CP) and the selling price(SP) and the task is to calculate the profit gained or loss incurred.Cost price or CP is the price at which the product is purchased by the seller and the selling price or SP is the price at which the product is sold by the seller.There is a formula to calculate profit gained or loss incurredProfit = Selling price – Cost priceIf Selling price is greater than cost price than there will be a profitLoss = Cost price – Selling priceIf cost price is greater than selling price than there will be ... Read More