Ayush Gupta has Published 530 Articles

How does a vector work in C/C++

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:20:01

3K+ Views

In this tutorial, we will be discussing a program to understand how vectors work in C/C++.A vector data structure is an enhancement over the standard arrays. Unlike arrays, which have their size fixed when they are defined; vectors can be resized easily according to the requirement of the user.This provides ... Read More

Count all sub-sequences having product <= K – Recursive approach in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:49:05

222 Views

In this tutorial, we will be discussing a program to find the number of sub-sequences having product k) {       discard_count += power(2, n - i);       return;    }    if (i == n)       return;       float rem = ... Read More

Count all possible walks from a source to a destination with exactly k edges in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:45:04

146 Views

In this tutorial, we will be discussing a program to find the number of walks from a source to a destination with exactly k edges.For this we will be provided with a graph and the values of source and destination. Our task is to find all the possible paths starting ... Read More

Count all prefixes of the given binary array which are divisible by x in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:40:52

115 Views

In this tutorial, we will be discussing a program to find the number of prefixes of the binary array which are divisible by x.For this we will be provided with binary array and a value x. Our task is to find the number of elements whose prefixes are divisible by ... Read More

Count all Quadruples from four arrays such that their XOR equals to ‘x’ in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:39:07

230 Views

In this tutorial, we will be discussing a program to find the number of quadruples from four arrays such that their XOR equals to x.For this we will be provided with four arrays and a value x. Our task is to count all the quadruples whose XOR is equal to ... Read More

Count all Prime Length Palindromic Substrings in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:36:09

181 Views

In this tutorial, we will be discussing a program to find the number of prime length palindromic strings.For this we will be provided with a string. Our task is to count all the sub strings which are palindromes and have prime lengths.Example Live Demo#include using namespace std; //checking for a ... Read More

Count all sub-arrays having sum divisible by k

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:33:19

244 Views

In this tutorial, we will be discussing a program to find the number of sub-arrays having sum divisible by k.For this we will be provided with an array and a value k. Our task is to find the number of sub arrays that are having their sum as equal to ... Read More

Count all sorted rows in a matrix in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:27:25

232 Views

In this tutorial, we will be discussing a program to find the number of all sorted rows in a matrix.For this we will be provided with m*n matrix. Our task is to count all the rows in the given matrix that are sorted either in ascending or descending order.Example Live Demo#include ... Read More

Count all the columns in a matrix which are sorted in descending in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:23:45

186 Views

In this tutorial, we will be discussing a program to find the number of columns in a matrix which are sorted in descending.For this we will be provided with a matrix. Our task is to count the number of columns in the matrix having elements sorted in descending order.Example Live Demo#include ... Read More

Count all the numbers in a range with smallest factor as K in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:20:56

166 Views

In this tutorial, we will be discussing a program to find the numbers in a range with the smallest factor as K.For this we will be provided with a range [a, b]. Our task is to count the numbers in the given range who have their smallest factor as K.Example Live ... Read More

Advertisements