
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

2K+ Views
Bit manipulation applies logical operations on a bit stream using bitwise operators like AND(&), OR(|), NOT(~), XOR(^), Left Shift() to get a required result. Using bitwise operators is beneficial as we can manipulate individual bits and they are faster than other operators. Problem Statement Given a number. Increment or add the number by 1 using bitwise operators only. (Don’t use arithmetic operators like ‘+’ , ‘-’, ‘*’ or’/’ ) Approach 1: Using One’s Complement / NOT Operator Bitwise complement / One’s complement is implemented using the NOT(~) Operator. For a number n, a bitwise complement of n i.e. ~n = ... Read More

1K+ Views
The fourth power of a number x is x raised to the power 4 or x4. Natural numbers are all positive integers excluding zero. Thus, the sum of the fourth powers of the first N natural numbers is − $\mathrm{Sum = 1^4 + 2^4 + 3^4 + 4^4 + … + N^4}$ This article describes some approaches for finding the sum using minimum time and space complexity. Problem Statement Given the number N, find the sum $\mathrm{1^4 + 2^4 + 3^4 + 4^4 + … + N^4}$. Example 1 Input: 3 Output: 98 Explanation $\mathrm{Sum = 1^4 + ... Read More

272 Views
The digit sum for a given number is the sum of all the digits present in the given number. We will be given a number n and s and we have to find all the numbers which are in the range 1 to n and have the difference between the number and the sum of its digits greater than s. We will implement two approaches with the code and the discussion on time and space complexity. Input N = 15, S = 5 Output 6 Explanation For all the numbers in the range 0 to 9, the difference ... Read More

393 Views
An array is a linear data structure that stores the elements and a sorted array contains all the elements in increasing order. Sorting an array by swapping the adjacent elements means we can swap the adjacent elements any number of times and we have to sort the array. We will be given two array’s first array is the array to be sorted and another array is a Boolean array that represents whether the current element is swappable or not. If the given array is of the length N then all the elements present will be from 1 to N. ... Read More

7K+ Views
Programming languages are used for many purposes such as making websites, developing mobile applications, etc. Graphic designing is one of the things that we can do by using the programming language. While graphic designing, we can face a problem where we have to project a 3-D object on the 2-D plane and due to which one dimension will be reduced or one face will be hidden. In this problem, we have to detect that hidden face. Back-Face detection is also known as the name Plane Equation method, and it is a method for the object space methods in which objects ... Read More

151 Views
Co-prime numbers are numbers that do not have any common divisor other than 1. We will be given two numbers n and m. We have to find the largest number in the range of 2 to n (both inclusive) which is co-prime with all the elements in the range of 2 to m (both inclusive). If none of the elements in the given range is co-prime with all the elements of the second range then we have to return or print -1. We will implement the approach, and code, and will discuss the time and space complexity of the program. ... Read More

305 Views
P smooth numbers are the numbers that have the maximum prime number that can divide them is less than or equal to the given number P. Prime numbers are the numbers that are divisible by only 1 and that number. 1 is by default considered as the P - smooth number for any given value of P. In this problem, we will be given a value P and the range and we have to return the number of elements that are present in that range and are P-smooth. Input Given the value of P is 7 and the range ... Read More

3K+ Views
In this problem, we will validate the Indian vehicle number plate using the regular expression. The regular expression is the search pattern created using the different characters, which we can use to match a particular pattern in the given string. Problem statement - We have given a string representing the Indian vehicle number plate. We need to use the regular expression to validate the given string. Sample Example Input: num1 = "GJ 03 AY 1097" Output: Yes Explanation - The given vehicle number plate is valid. Input: num2 = "TN 1A3 PZ 1287" ... Read More

691 Views
In this problem, we need to show all words of the string having the prime length. The logical part of the problem is getting the words from the string and checking whether its length is prime. We can check whether the length of the number is divisible by any number to ensure whether it is a prime number. Also, we will use the sieve of Eratosthenes and the wheel factorization algorithm to check whether the word length is a prime number. Problem statement − We have given a string alpha, and we need to print all words of ... Read More

217 Views
In this problem, we will count the number of operations required by increasing the prefix characters of the given string. We will use character difference to count the minimum number of operations required to make string palindromic. Problem Statement We have given a string nums containing the numeric digits. We need to count a minimum number of operations required to convert a string into the palindrome. In one operation, we can select any prefix of the string and increment all prefix characters by 1. Sample Example Input nums = "22434" Output 2 Explanation ... Read More