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

340 Views
In this problem, we are given a doubly linked list LL. Our task is to find the largest node in Doubly Linked List.Let's take an example to understand the problem, Input : linked-list = 5 -> 2 -> 9 -> 8 -> 1 -> 3 Output : 9Solution ApproachA simple approach to solve the problem is by traversing the linked-list and if the data value of max is greater than maxVal's data. After traversing the linked-list, we will return the macVal nodes data.ExampleProgram to illustrate the working of our solution#include using namespace std; struct Node{ int data; ... Read More

196 Views
In this problem, we are given an array arr[] of size N consisting of single digits only. Our task is to find the largest multiple of 2, 3 and 5.Let's take an example to understand the problem, Input : arr[] = {1, 0, 5, 2} Output : 510Explanation −The number 510 is divisible by all 2, 3, 5. Solution ApproachA simple solution to the problem is by checking for basic divisibility of the number created.So, if the number needs to be divisible by 2 and 5 i.e. it is divisible by 10. For creating a number divisible by 10, the ... Read More

299 Views
In this problem, we are given a number N. Our task is to find the largest good number in the divisors of given number N.A good number is a number in which every digit is larger than the sum of digits of its right (all less significant bits than it). For example, 732 is a good number, 7> 3+2 and 3>2.Let's take an example to understand the problem, Input : N = 15 Output : 15Explanation −Divisors of 15 : 1, 3, 5, 15. Solution ApproachA simple solution to the problem is by finding all the divisors of N. And ... Read More

289 Views
In this problem, we are given a binary tree BT. Our task is to find the largest BST subtree in a given Binary Tree.Binary Tree is a special data structure used for data storage purposes. A binary tree has a special condition that each node can have a maximum of two children.Binary Search Tree (BST)is a tree in which all the nodes follow the below-mentioned properties −The value of the key of the left sub-tree is less than the value of its parent (root) node's key.The value of the key of the right subtree is greater than or equal to ... Read More

201 Views
In this problem, we are given an array aar[] of size n and another array del[] of size m. Our task is to find the largest after deleting the given elements. If the deletion of an element with multiple instances is required, delete the first instance of the element.Let's take an example to understand the problem, Input : arr[] = {3, 5, 1, 7, 9, 2}, del[] = {1, 9, 3} Output : 7Explanation −Array arr[] after deleting the elements : {5, 7, 2} Largest element of the array is 7Solution ApproachA simple solution the problem is by deleting all ... Read More

174 Views
In this problem, we are given a tree of size N, a node of the tree V and k. Our task is find the Kth node in the DFS traversal of a given subtree in a Tree.We need to find the kth node in the DFS traversal of the tree starting from vertex V.Let's take an example to understand the problem, Input :V = 2, k = 3Output : 4Explanation −The series is {1, 2, 3, 5, 6, 7} The 4th element is 5.Solution ApproachA simple solution to the problem is find the DFS traversal of the node V and ... Read More

248 Views
In this problem, we are given a N range of integer values between intervals L - R as an matrix range[N][2] and an integer value k. Our task is to find the kth element in the series generated by the given N ranges.Let's take an example to understand the problem, Input : ranges[][] = {{1, 3}, {5, 7}}, k = 4 Output : 5Explanation −The series is {1, 2, 3, 5, 6, 7} The 4th element is 5.Solution ApproachA simple solution to the problem is by creating a series of integers for the given ranges and then find the elements ... Read More

546 Views
In this problem, we are given two integer values N and k. Our task is to find the k-th smallest divisor of a natural number N.Let's take an example to understand the problem, Input : N = 15, k = 3 Output : 5Explanation −Factors of 15 are 1, 3, 5, 15 3rd smallest is 5Solution ApproachA simple solution to the problem is by finding the factors of the number and storing them in sorted manner and printing kth values.For sorting, we will loop till root(N) and check if N is divisible by i. And store the value of i ... Read More

210 Views
In this problem, we are given an array arr[] of size n, array del[] of size m, and an integer k. Our task is to find the k smallest numbers after deleting the given elements.We need to print the first k smallest elements from the array arr[] found after deleting all elements present in the del[] array. If two instances are present in the array delete the first instance.Let's take an example to understand the problem, Input : arr[] = {3, 5, 1, 7, 9, 2}, del[] = {1, 9, 3}, k = 2 Output : 2, 5Explanation −Array arr[] ... Read More

296 Views
In this problem, we are given an array arr[] of size n, array del[] of size m, and an integer k. Our task is to find the k largest numbers after deleting the given elements.We need to print the first k largest elements from the array arr[] found after deleting all elements present in the del[] array. If two instances are present in the array delete the first instance.Let's take an example to understand the problem, Input : arr[] = {3, 5, 1, 7, 9, 2}, del[] = {1, 9, 3}, k = 2 Output : 7, 5Explanation −Array arr[] ... Read More