Skip to content
the poor coder

Home / Topics / #c

#C++

34 posts
2020

Hackerrank Deque-STL Solution

Double ended queue or Deque(part of C++ STL) are sequence containers with dynamic sizes that can be expanded or contracted on both ends (either its front or its back). The member functions of deque that are mainly used…

2020

Hackerrank Virtual Functions Solution

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 Professor and Student should inherit…

2020

Hackerrank Exceptional Server Solution

Your friend set up a small computational server that performs complex calculations. It has a function that takes large numbers as its input and returns a numeric result. Unfortunately, there are various exceptions that…

2020

Hackerrank Inherited Code Solution

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 too short. Upon review, you…

2020

Hackerrank Rectangle Area Solution

Create two classes: Rectangle The Rectangle class should have two data fields-width and height of int types. The class should have display() method, to print the width and height of the rectangle separated by space…

2020

Hackerrank Print Pretty Solution

Your manager gave you a text file with many lines of numbers to format and print. For each row of space-separated doubles, format and print the numbers using the specifications in the Output Format section below. Input…

2020

Hackerrank Maps-STL Solution

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 specific order.The mainly used member functions of maps are: Map…

2020

Hackerrank Sets-STL Solution

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 sets: Declaration: Size: Insert: Erasing an element…

2020

Hackerrank Lower Bound-STL Solution

You are given integers in sorted order. Also, you are given queries. In each query, you will be given an integer and you have to tell whether that integer is present in the array. If so, you have to tell at which index…

2020

Hackerrank Vector-Erase Solution

You are provided with a vector of integers. Then, you are given queries. For the first query, you are provided with integer, which denotes a position in the vector. The value at this position in the vector needs to be…

2020

Hackerrank Vector-Sort Solution

You are given integers.Sort the integers and print the sorted order. Store the integers in a vector.Vectors are sequence containers representing arrays that can change in size. Declaration: Size: Pushing an integer into…

ESC