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

620 Views
We are given a vector and the task is to calculate the count of those elements in a vector that matches a target value or condition.Vectors are sequence containers that can change size. Container is an object that holds data of the same type. Sequence containers store elements strictly in linear sequence.Vector stores elements in contiguous memory locations and enables direct access to any element using subscript operator []. Unlike arrays, vectors can shrink or expand as needed at run time. The storage of the vector is handled automatically.To support shrink and expand functionality at runtime, vector containers may allocate ... Read More

715 Views
We are given a string with let’s say str of any length and the task is to calculate the count of consonants in the given string using both iterative and recursive methods.Consonants are those alphabets that are not vowel i.e alphabets except a, i, e, o, u are considered as consonants. So in the program below we need to find the count of alphabets other than these in string.The Recursion and Iteration both repeatedly execute the set of instructions. Recursion is when a statement in a function calls itself repeatedly. The iteration is when a loop repeatedly executes until the ... Read More

608 Views
We are given two strings, let's say str1 and str2 containing characters and the task is to calculate the common subsequences in both the strings. In the below program we are using dynamic programming and for that we need to know what dynamic programming is and at what problems it can be used.Dynamic programming approach is similar to divide and conquer in breaking down the problem into smaller and yet smaller possible sub-problems. But unlike, divide and conquer, these subproblems are not solved independently. Rather, results of these smaller subproblems are remembered and used for similar or overlapping sub-problems.Dynamic programming ... Read More

310 Views
We are given a positive number let’s say num and the task is to calculate the count of changes in the Led lights displayed one by one. We will assume that initially all LEDs are off and they will be started based upon the string value.For solving this question we need to understand what a seven segment display is and its working.What are Seven Segment DisplaysSeven segment displays are the output display device that provide a way to display information in the form of image or text or decimal numbers which is an alternative to the more complex dot matrix ... Read More

576 Views
We are given two integer numbers let’s say num1 and num2 and the task is to divide the num1 with num2 and calculate the count of digits after decimal on dividing these given numbers.For ExampleInput − num1 = 2, num2 = 5 Output − count is 1Explanation − when we divide 2 with 5 i.e. ? = 0.4, so digits after decimal is 1 therefore count is 1.Input − num1 = 2, num2 = 0 Output − Floating point exception (core dumped)Explanation − when we divide any number with 0 it will return an error and terminate the program abnormally.Input ... Read More

267 Views
We are given a binary search tree made up of nodes and also a range and the task is to calculate the count of nodes that lies in the given range and display the result.A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −The left subtree of a node has a key less than or equal to its parent node's key.The right subtree of a node has a key greater than to its parent node's key.Thus, BST divides all its sub-trees into two segments; the left subtree and the right subtree and ... Read More

564 Views
We are given an array let’s say, arr[] of integer elements of any given size and a positive integer k and the task is to calculate the count of those element pairs whose absolute difference doesn’t exceed the given integer k.Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.For exampleInput − int arr[] = {2, 3, 6, 12, 14}, k= ... Read More

307 Views
We are given an array let’s say, arr[] of integer elements of any given size and the task is to calculate the count of the factors of a number calculated by multiplying all the array elements.Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.For exampleInput − int arr[] = {2, 3} Output − count is 4Explanation − the multiplication of ... Read More

327 Views
We are given an array let’s say, arr[] of integer values and the task is to calculate the count of array elements that divides the sum of all other elements.Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.For ExampleInput − int arr_1[] = {9, 6, 3} Output − count is 3Explanation − As the sum of elements 9+6 = 15 ... Read More

252 Views
We are given with two arrays let’s say, arr_1[] and arr_2[] having integer values and the task is to calculate the count of distinct pairs having the same sum of digits. It means, one value should be selected from an arr_1[] and second value from arr_2[] to form a pair and both the values should have the same sum digits.Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as ... Read More