Queries to find whether a number has exactly four distinct factors or not in C++

Ayush Gupta
Published on 14-Aug-2020 15:15:35
In this tutorial, we will be discussing a program to find queries to find whether a number has exactly four distinct factors or not.For this we will be provided with Q queries each containing a number N. Our task is to find if the given number have exactly four divisors.Example Live ... Read More

Queries to find the last non-repeating character in the sub-string of a given string in C++

Ayush Gupta
Published on 14-Aug-2020 15:14:02
In this tutorial, we will be discussing a program to find queries to find the last nonrepeating character in the sub-string of a given string.For this we will be provided with a string with Q queries. Our task is to find the last non-repeating character in the given range.Example Live Demo#include<bits/stdc++.h> ... Read More

Queries to find maximum product pair in range with updates in C++

Ayush Gupta
Published on 14-Aug-2020 15:11:21
In this tutorial, we will be discussing a program to find queries to find maximum product pair in range with updates.For this we will be provided with an array containing integers. Our task is to perform Q queries (printing the maximum pair product, updating array[i] with given value).Example Live Demo#include <bits/stdc++.h> ... Read More

Queries to find distance between two nodes of a Binary tree – O(logn) method in C++

Ayush Gupta
Published on 14-Aug-2020 15:08:48
In this tutorial, we will be discussing a program to find queries to find distance between two nodes of a Binary tree – O(logn) method.For this we will be provided with a binary tree with no parent pointers. Our task is to find the distance between two keys in the ... Read More

Queries to count the number of unordered co-prime pairs from 1 to N in C++

Ayush Gupta
Published on 14-Aug-2020 15:04:23
In this tutorial, we will be discussing a program to find queries to count the number of unordered co-prime pairs from 1 to N.For this we will be provided with an integer N. Our task is to find the number of unordered co-prime pairs from 1 to N.Example Live Demo#include <bits/stdc++.h> ... Read More

Queries to check whether a given digit is present in the given Range in C++

Ayush Gupta
Published on 14-Aug-2020 15:02:12
In this tutorial, we will be discussing a program to find queries to check whether a given digit is present in the given Range.For this we will be provided with an array, and Q queries. Our task is to find whether the given number is present between the given indices ... Read More

Queries to check if it is possible to join boxes in a circle in C++

Ayush Gupta
Published on 14-Aug-2020 14:57:39
In this tutorial, we will be discussing a program to find queries to check if it is possible to join boxes in a circle.For this we will be provided with a circle of boxes running from 1 to n. Our task is to find whether box i can be connected ... Read More

Queries to check if a number lies in N ranges of L-R in C++

Ayush Gupta
Published on 14-Aug-2020 14:55:10
In this tutorial, we will be discussing a program to find queries to check if a number lies in N ranges of L-R.For this we will be provided with a list of ranges and queries. Our task is to find whether the number provided in each query lies in any ... Read More

Queries to answer the X-th smallest sub-string lexicographically in C++

Ayush Gupta
Published on 14-Aug-2020 14:53:17
In this tutorial, we will be discussing a program to find queries to answer the X-th smallest sub-string lexicographically.For this we will be provided with a string and Q queries. Our task is to print the smallest sub-string lexicographically at the given position in the query.Example Live Demo#include <bits/stdc++.h> using namespace ... Read More

C++ Find distance between two nodes of a Binary Tree.

Ayush Gupta
Published on 14-Aug-2020 14:51:46
In this tutorial, we will be discussing a program to find distance between two nodes of a Binary Tree.For this we will be provided with a binary tree with no parent pointers. Our task is to find the distance between two keys in the tree counting the edges.Example Live Demo#include <iostream> ... Read More
Advertisements