Problem Description: Given an array of elements consisting of 0, 1, 2. Sort the array. Example: {1, 2, 0, 0, 1, 2, 1} Output: {0, 0, 1, 1, 1, 2, 2} Solution explanation: The solution is very simple, we count the number of 0’s, 1’s and …
Problem Description: A baby wants to climb the stairs. It can take a single step at a time or take 2 steps at a time. Or it can take a combination of 1 and 2 steps at a time. Given that there are N stairs, find …
Solution Description: This problem can be solved in 2 different ways. Solution 1: Brute Force Technique Explanation: In this technique, we shall be taking 2 loops. Outer Loop and Inner Loop. Step 1: First take the first element of the outer loop and add it to …
In this chapter we are going to study: If condition If-else condition If-else-if condition Nested-if Switch Statement These conditional statements help us to navigate the program flow based on certain conditions. Above mentioned are the control statements that C language supports. If condition: If statement …
In this Chapter we are learning about the below topics: Arithmetic Operators. Assignment Operators. Relational Operators. Logical Operators. Bitwise operators. Conditional Operators. Increment and Decrement Operators. Arithmetic Operators. Below is the list of arithmetic operators: Operator Operator Name Example + Addition 3 + 3 = …