Operator Overloading in C++ Hacker Rank Solution

Objective 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 pe…

Overload Operators in C++ Hacker Rank Solution

Objective 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 op…

For Loop in C++ Hacker Rank Solution

Objectives A for loop is a programming language statement which allows code to be repeatedly executed. The syntax for this is Syntax : for ( <expression_1> ; <expression_2> ; <expression_3> ) <statement> expression_1 is use…

Conditional Statements in C++ Hacker Rank Solution

Problem if and else are two of the most frequently used conditionals in C/C++, and they enable you to execute zero or one conditional statement among many such dependent conditional statements. We use them in the following ways: 1.  if: This executes …

String Formatting in Python HackerRank Solution

Problem Given an integer , n, print the following values for each integer i from 1to n : Decimal Octal Hexadecimal (capitalized) Binary The four values must be printed on a single line in the order specified above for each i from 1 to n. Each value sh…

Designer Door Mat in Python HackerRank Solution

Problem Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat with the following specifications: Mat size must be N X M. ( N is an odd natural number, and M is 3 times N.) The design should have ‘WELCOME’ written i…

Alphabet Rangoli in Python HackerRank Solution

Problem You are given an integer, N. Your task is to print an alphabet rangoli of size N. (Rangoli is a form of Indian folk art based on creation of patterns.) Different sizes of alphabet rangoli are shown below: #size 3----c------c-b-c--c-b-a-b-c--c-…

Load More
That is All