You've successfully subscribed to The Poor Coder | Hackerrank Solutions
Great! Next, complete checkout for full access to The Poor Coder | Hackerrank Solutions
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.

C++

Beeze Aal

Hackerrank C++ Class Template Specialization Solution

You are given a main function which reads the enumeration values for two different types as input, then prints out the corresponding  enumeration names. Write a class template that can provide the names of the enumeration values for both types. If the enumeration value is not valid, then print unknown.
Beeze Aal

Hackerrank Attending Workshops Solution

A student signed up for  workshops and wants to attend the maximum number of workshops where no two workshops overlap. You must do the following: Implement  structures: struct Workshop having the following members: The workshop's start time.The workshop's duration.The workshop's end time.struct Available_Workshops having the following
Beeze Aal

Hackerrank Operator Overloading Solution

Classes define new types in C++. Types in C++ not only interact by means of constructions and assignments but also via operators. For example: int a=2, b=1, c; c = b + a; The result of variable c will be 3. Similarly, classes can also perform operations using operator overloading.
Beeze Aal

Hackerrank Accessing Inherited Functions Solution

You are given three classes A, B and C. All three classes implement their own version of func. In class A, func  multiplies the value passed as a parameter by : class A { public: A(){ callA = 0; } private: int callA; void inc(){ callA++; } protected: void func(int & a) { a = a
Beeze Aal

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 are: Deque Template: std::deque<value_type> Declaration: deque&
Beeze Aal

Hackerrank Virtual Functions Solution

.MathJax_SVG_LineBox {display: table!important} .MathJax_SVG_LineBox span {display: table-cell!important; width: 10000em!important; min-width: 0; max-width: none; padding: 0; border: 0; margin: 0} This problem is to get you familiar with virtual functions. Create three classes Person, Professor and Student. The class Person should have data members
Beeze Aal

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 may occur during execution. Complete the code in your editor so that it prints appropriate error
Beeze Aal

Hackerrank Inherited Code Solution

.MathJax_SVG_LineBox {display: table!important} .MathJax_SVG_LineBox span {display: table-cell!important; width: 10000em!important; min-width: 0; max-width: none; padding: 0; border: 0; margin: 0} 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
Beeze Aal

Hackerrank Overload Operators Solution

You are given a class - Complex. class Complex { public: int a,b; }; Operators are overloaded by means of operator functions, which are regular functions with special names. Their name begins with the operator keyword followed by the operator sign that is overloaded. The syntax is: type operator sign (parameters)
Beeze Aal

Hackerrank Preprocessor Solution Solution

Preprocessor directives are lines included in the code preceded by a hash sign (#). These lines are directives for the preprocessor. The preprocessor examines the code before actual compilation of code begins and resolves all these directives before any code is actually generated by regular statements. #define INF 10000000 if( val
Beeze Aal

Hackerrank C++ Class Templates Solution

A class template provides a specification for generating classes based on parameters. Class templates are generally used to implement containers. A class template is instantiated by passing a given set of types to it as template arguments. Here is an example of a class, MyTemplate, that can store one element
Beeze Aal

Hackerrank Multi Level Inheritance Solution

Solve the problem Inheritance-Introduction before solving this problem. In the previous problem we learned about Inheritance and how can a derived class object use the member functions of the base class. In this we will see what multi-level inheritance is. Suppose we have a class A which is the base