ProDeveloperTutorialonAugust 7, 2026 Bitwise Operators: Perform below operations using Bitwise Operators 1. Get the value of nth bit 2. Set the value of nth bit 3. Clear the value of nth bit 4. Toggle the nth bit 5. Get the total number of set… Discover More
ProDeveloperTutorialonAugust 7, 2026 Bitwise Operators: Given 2 numbers check if one number is complement of another and also check if those two numbers are same using bitwise operators Check if one number is a complement of another: One’s complement of a number is obtained by inverting all the bits. Example: num_1 = 10 num_2… Discover More
ProDeveloperTutorialonAugust 7, 2026 Bitwise Operators: Check if the number has bits in alternate pattern and also check if the same number has equal number of set and unset bits using bitwise operators Check if the number has bits in alternate pattern The solution contains 3 steps: 1. Right shift the number by 1 2. XOR the above result with… Discover More
ProDeveloperTutorialonAugust 7, 2026 Bitwise Operators: Calculate the square of a number and also check if that number is even or odd using bitwise operator. Calculate the square of a number using bitwise operator. Truth table of binary multiplication is below: 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 =… Discover More
ProDeveloperTutorialonAugust 7, 2026 Bitwise Operators: Add and subtract 2 numbers using bitwise operators. We can solve this by using bit manipulation. Addition using bitwise operators: XOR (^) operation will give us addition of 2 bits. Carry bit… Discover More
ProDeveloperTutorialonAugust 7, 2026 Bitwise Operators: Given a binary number, return the 1’s and 2’s complement of that number Before getting into programming, we shall look at how to get 1’s and 2’s complement of a given binary number. 1’s Complement: 1’s complement… Discover More
ProDeveloperTutorialonAugust 7, 2026 Arrays: Implement prefix sum array Problem Statement: You are given an array, you need to find the prefix sum of the array. Prefix sum array is a new array of same size of… Discover More
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given a string, reverse the string. Example 1: Input: "hello" Output: "olleh" Example 2: Input: “ProDeveloperTutorial is a good website” Output: etisbew doog… Discover More
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given an array that is sorted and a target, if the target is found, return the index. If not found, return the index where it would be if it were inserted Example 1: Input: [1,2,3,6], 6 Output: 3 Example 2: Input: [1,2,3,6], 5 Output: 3 Method 1: By using “lower_bound” STL function. By using… Discover More
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given a sorted array, find the starting and ending index that matches the target Given a sorted array and an element “k”. Get the start index and the end index of the given “k” value. Example 1: Array: [1, 2, 3, 4, 4, 4, 5,… Discover More