Deque-STL in C++ – Hacker Rank Solution
Problem You inherited a piece of code that performs username validation for your company’s website. The existing function works reasonably well, but it throws an exception when the username is…
Problem You inherited a piece of code that performs username validation for your company’s website. The existing function works reasonably well, but it throws an exception when the username is…
Problem Your manager gave you a text file with many lines of numbers to format and print. For each row of 3 space-separated doubles, format and print the numbers using the specifications…
Problem Maps are a part of the C++ STL. Maps are associative containers that store elements formed by a combination of a key value and a mapped value, following a…
Problem You are given N integers in sorted order. Also, you are given Q queries. In each query, you will be given an integer and you have to tell whether that integer is present…
Problem Sets are a part of the C++ STL. Sets are containers that store unique elements following a specific order. Here are some of the frequently used member functions of…
Problem You are provided with a vector of N integers. Then, you are given 2 queries. For the first query, you are provided with 1 integer, which denotes a position…
Problem You are given N integers. Sort the N integers and print the sorted order.Store the N integers in a vector. Vectors are sequence containers representing arrays that can change in size. Declaration : vector<int>v; (creates…
Problem Abstract base classes in C++ can only be used as base classes. Thus, they are allowed to have virtual member functions without definitions.A cache is a component that stores…
Problem This problem is to get you familiar with virtual functions. Create three classes Person, Professor and Student. The class Person should have data members name and age. The classes…
Problem Your friend set up a small computational server that performs complex calculations.It has a function that takes 2 large numbers as its input and returns a numeric result. Unfortunately, there are…
Problem You inherited a piece of code that performs username validation for your company’s website. The existing function works reasonably well, but it throws an exception when the username is…
Problem Design a class named Box whose dimensions are integers and private to the class. The dimensions are labelled: length l, breadth b, and height h.The default constructor of the class should initialize l, b,…