In this article, we will discuss the use of a digit separator in C++. Sometimes, it becomes difficult to read numbers that contain many digits. For example, 1000 is readable but what if more zeros are added to it, let’s say 1000000, now it becomes a little difficult to read, and what will happen if more zeros are added to it. In real life, commas (, ) are added to the number. For Example: 10, 00, 000. Now it is easy to read, that is ten lakhs....
In share trading, a buyer buys shares and sells on a future date. Given the stock price of N days, the trader is allowed to make at most K transactions, where a new transaction can only start after the previous transaction is complete. The task is to find out the maximum profit that a share trader could have made....
Given a Binary Search Tree with two of the nodes of the Binary Search Tree (BST) swapped. The task is to fix (or correct) the BST.Note: The BST will not have duplicates....
The unordered_map::bucket() is a built-in STL function in C++ which returns the bucket number where the element with the key k is located in the map. Syntax:...
Priority queues are a type of container adaptors, specifically designed such that the first element of the queue is either the greatest or the smallest of all elements in the queue. However, in C++ STL (by default) the largest element is at the top. We can also create a priority queue having the smallest element at the top by simply passing an extra parameter while creating the priority queue....
Lists are containers used in C++ to store data in a non-contiguous fashion, Normally, Arrays and Vectors are contiguous in nature, therefore the insertion and deletion operations are costlier as compared to the insertion and deletion option in Lists....
Given an array, write a program to find the sum of array using pointers arithmetic. In this program we make use of * operator . The * (asterisk) operator denotes the value of variable. The * operator at the time of declaration denotes that this is a pointer, otherwise it denotes the value of the memory location pointed by the pointer . sum() function is used to find the sum of the array through pointers....
Function object for performing multiplication. Effectively calls operator* on two instances of type T....
Given a number, print words for individual digits. It is not allowed to use if or switch.Examples:...
Given an unsorted array of non-negative integers, find a continuous subarray that adds to a given number. Examples :...
Given 3 integers N, M, and K. The task is to find maximum P such that N * KP ? M....