You are given an array and you need to find number of tripets of indices such that the elements at those indices are in geometric progression for a given common ratio and . For example, . If , we have and at indices and…
Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the…
Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the…
Objective This challenge will help you learn the concept of recursion. A function that calls itself is known as a recursive function. The C programming language supports recursion. But while using recursion, one needs…
Objective This challenge will let you learn about bitwise operators in C. Inside the CPU, mathematical operations like addition, subtraction, multiplication and division are done in bit-level. To perform bit-level…
Objective In this challenge, you will learn the usage of the for loop, which is a programming language statement which allows code to be repeatedly executed. The syntax for this is expression_1 is used for intializing…
Objective 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…
Objective In this challenge, you will learn to implement the basic functionalities of pointers in C. A pointer in C is a way to share a memory address among different contexts (primarily functions). They are primarily…
Objective In this challenge, you will learn simple usage of functions in C. Functions are a bunch of statements glued together. A function is provided with zero or more arguments, and it executes the statements on it…
Objective The fundamental data types in c are int, float and char. Today, we're discussing int and float data types. The printf() function prints the given statement to the console. The syntax is printf("format…
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…
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…
Classes define new types in C++. Types in C++ not only interact by means of constructions and assignments but also via operators. For example: The result of variable c will be 3. Similarly, classes can also perform…
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 : In class B, func multiplies the value passed as a parameter…
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…
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…
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…
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…
You are given a class - Complex. 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…