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

359 Views
We are given the range starting from an integer value holded by a variable let’s say start till the variable end and the task is to count the total number of factorial numbers available in the given range.What is a factorial numberFactorial of a number is calculated by multiplying the digits in a number while decrementing thevalue of digit by 1. It is denoted by the symbol ‘!’ i.e. 0!, 1!, 2!, 3!, 5!, ...., etc. Factorial of 0! and 1! is always 1.I.e. factorial of 2 = 2 * (2-1) = 2 * 1 = 2 ... Read More

3K+ Views
We are given with an integer number and the task is to count the even numbers and the odd numbers in a digit. Also, we will keep check on whether the even digits in an integer are occurring an even number of times and also the odd digits in an integer are occurring an odd number of times.For ExampleInput − digit = 12345 Output − count for even digits = 2 count for odd digits = 3Explanation − Yes, Also, even digits are occurring even number of times i.e. 2 and odd digits are occurring odd number ... Read More

2K+ Views
We are given with the two strings let’s say str1 and str2 and the task is to find the count of common characters in two strings i.e. if str1[i] = str[j], then they will be considered as a pair and count will increased to 1 and if str1[i]!=str2[j] then they willn’t be considered as a pair and count willn’t increase to 1.For ExampleInput − str1 = “hello” str2 = “heoo” Output − count is: 3Explanation − str1[0] = str2[0] i.e. h ; str1[1] = str2[1] i.e. e ; str1[2]!=str2[2] i.e. l and o; str1[3]=str2[3] i.e. o. So, the ... Read More

586 Views
We are given a string of any length and the task is to convert the string having uppercase letters to lowercase letters and lowercase letters to uppercase letters.For ExampleInput − string str = ”Welcome To The Site!”Output − wELCOME tO tHE sITE!Explanation − converted the letters W, T, T, S to lowercase and letters e, l, c, o, m, e, o, , i, t, e to uppercase and it doesn’t perform any operations to the special characters.Input − string str = ”HELLO”Output − helloExplanation − converted the letters H, E, L, L, E to lowercase.This can be done using two different approachesUsing inbuilt functions provided by ... Read More

795 Views
Suppose there is a special square room with mirrors on each of the four walls. In each corner except the southwest corner, there are receptors. These are numbered as 0, 1, and 2. Now the square room has walls of length p, and a laser ray from the southwest corner first meets the east wall at a distance q from the 0th receptor. We have to find the number of the receptor that the ray meets first.So if p = 2, and q = 1, then the case will be like −So the output will be 2, as the ray ... Read More

383 Views
Suppose we have a balanced parentheses string S, we have to compute the score of the string based on the following rule −The () has score 1AB has score A + B, where A and B are two balanced parentheses strings.(A) has score 2 * A, where A is a balanced parentheses string.So if the input is like “(()(()))”, then the output will be 6.To solve this, we will follow these steps −ans := 0, define a stack stfor i in range 0 to size of string Sif S[i] is opening parentheses, then insert -1 into stackotherwiseif top of stack ... Read More

536 Views
Suppose there are N cars that are going to the same destination along a one lane road. The destination is ‘target’ miles away. Now each car i has a constant speed value speed[i] (in miles per hour), and initial position is position[i] miles towards the target along the road.A car can never pass another car ahead of it, but it can catch up to it, and drive bumper to bumper at the same speed. Here the distance between these two cars is ignored - they are assumed to have the same position. A car fleet is some non-empty set of ... Read More

3K+ Views
Suppose we have a string S of lowercase letters, and an integer array shifts. The shift of a letter means the next letter in the alphabet, for z, it will be a. Now for each shifts[i] = x, we want to shift the first i+1 letters of S, x times. We have to find the final string after all such shifts to S are applied. So if the string is “abc” and shifts = [3, 5, 9], then after shifting the first 1 letter of S by 3, will have “dbc”, shifting first two letters of S by 5, we ... Read More

573 Views
Suppose Rima has a hand of cards, given as an array of integers. Now she wants to shuffle the cards into groups so that each group is size W, and consists of W consecutive cards. We have to check whether it is possible or not.So if the cards are [1, 2, 3, 6, 2, 3, 4, 7, 8], and W = 3, then the answer will be true, as she can rearrange them like [1, 2, 3], [2, 3, 4], [6, 7, 8]To solve this, we will follow these steps −Define a map m, and store frequency of each element ... Read More

543 Views
Consider any (contiguous) subarray B (of A) a called mountain if the following properties hold −size of B >= 3There exists some 0 < i < B.length - 1 such that B[0] < B[1] < ... B[i-1] < B[i] > B[i+1] > ... > B[B.length - 1]Suppose we have an array A of integers; we have to find the length of the longest mountain. We have to return 0 if there is no mountain. So if the input is like [2, 1, 4, 7, 3, 2, 5], then the result will be 5. So the largest mountain will be [1, ... Read More