C / C++
In this section, we share here all the code in C, C++ computer language. C, CPP++ are the two basic and important languages for placement, interview preparation.
C++ or Python | Which Programming Language Deserves More Praise?
C++ and Python are two of the most popular programming languages. They are both object-oriented languages, but there are some important differences between them. C++ is a...
35+ Competitive Coding Questions with Solutions | asked in Interviews 2022
Here is the list of competitive coding questions answers. These latest coding challenges are asked in the product-based companies in recent times (2021-2022). Almost all the...
Divide and Multiply a number by Two using Bitwise Operator (Without...
Why use left-shift and right-shift operators instead of generic divide(/) and multiply(*) operators? Explanation: The '/' and '*' operators can be very time-consuming...
C++ Program to Find the nth Bit of Number (Bit Masking)
Sometimes interviewers also twist the question and ask you to check if the nth bit is set or not. You have to follow the same approach. Algorithm and approach: Left shift 1...
C++ Program to Count the Number of Set Bits in a Number
The easy solution to this problem is to convert the given number into a binary string. Loop over all the characters in the string. A number of ones in the string are nothing but...
C++ Program to Check Odd or Even Number without using Modulo
We all know about the odd and even numbers. In simple terms, if the number is divisible by two, it is even. If the number is not divisible by two, it is...
Write a Program to Find the Median of Array (by Sorting)
Explanation You will be given a list of numbers. Let's say 7, 8, 4, 5, 2 First, you have to sort the numbers using the swapping methodology. Sorted list: 2, 4, 5, 7,...
Write a Program to Find the Transpose of a Matrix
Explanation Transposing a matrix is also known as flipping a matrix where rows become columns and columns become rows, In other words, lets M is a matrix and Transpose of...
Second Largest/Smallest Number in Array in C/C++, Java and Python
In an earlier tutorial, we have seen how to find the smallest or largest number from the integer array. In this tutorial, we are going to find the second smallest number in an...