Count of paths in given Binary Tree with odd bitwise AND for Q queries
Given an integer Q representing the number of queries and an array where each query has an integer N. Our task is to iterate through each query and find the number of paths such that bitwise AND of all nodes on that path is odd....
read more
Find maximum element among the elements with minimum frequency in given Array
Given an array arr[] consisting of N integers, the task is to find the maximum element with the minimum frequency....
read more
Number of submatrices with all 1s
Given an N*N matrix containing only 0s and 1s, the task is to count the number of submatrices containing all 1s....
read more
Minimum Moves for adjacent stars
Given a string s consisting of ‘.’ and ‘*’, In one move you can shift ‘*’, one index left or one index right if there is a ‘.’ present there, the task is to make an arrangement such that all the * are adjacent to each other i.e. there is no ‘.’ between any two ‘*’ Print the minimum number of moves required to do so....
read more
Count number of 1’s at specific position in a matrix – II
Given a binary matrix mat[][] of size m*n (0-based indexing), the task is to return the total number of 1’s in the matrix that follows the below two rules. i.e:...
read more
Smallest positive integer that does not divide any elements of the given array
Given an array arr[] consisting of N positive integers, the task is to determine the smallest positive integer K such that none of the array elements is divisible by K....
read more
Sum of first K numbers which are not divisible by N
Given two numbers N and K, the task is to find the sum of first K numbers which are not divisible by N.Examples:...
read more
Remove characters from a numeric string such that string becomes divisible by 8
Given a non-negative integer represented in the form of a numeric string str. Remove zero or more characters from the string such that the number becomes divisible by 8. If it is possible, print the string after removing the characters otherwise print -1.Examples:...
read more
Minimum number of operations to make maximum element of every subarray of size K at least X
Given an array A[] of size N and an integer K, find minimum number of operations to make maximum element of every subarray of size K at least X. In one operation, we can increment any element of the array by 1....
read more
Debugging in Turbo C++
Debugging is a process in which the programmers detect and remove the existing or potential errors/bugs in their programs. It is an excellent practice for writing an effective code. Now, Turbo C++ provides a variety of useful features for the sake of its community. Some options that play an important role in our debugging are Watch and Trace. Let’s understand these concepts by taking the following program:...
read more
Maximum profit by buying and selling a share at most K times | Greedy Approach
In share trading, a buyer buys shares and sells on a future date. Given the stock price of N days, the trader is allowed to make at most K transactions, where a new transaction can only start after the previous transaction is complete. The task is to find out the maximum profit that a share trader could have made....
read more
Bit Manipulation for Competitive Programming
Bit manipulation is a technique in competitive programming that involves the manipulation of individual bits in binary representations of numbers. It is a valuable technique in competitive programming because it allows you to solve problems efficiently, often reducing time complexity and memory usage....
read more