News Leaflets
A leading news portal.
Browsing Category

# Technology

## Modify array to another given array by replacing array elements with the sum of the array | Set-2

Given an Array input consisting only of 1s initially and an array target of size N, the task is to check if the array input can be converted to target by replacing input with the sum of array elements in each step.Examples:Input: input = {…

## Print List of nodes of given n-ary Tree with number of children in range [0, n]

#include <bits/stdc++.h>using namespace std;  class Node {public:    int key_ele;    vector<Node*> child;      Node(int data_value)    {        key_ele = data_value;    }};  int numberOfChild(Node* root, int ele){    int num =…

## Longest Substring with at most X 0s and Y 1s of given String

Given a binary string S of length N, the task is to find the longest substring with at most X number of 0’s and Y number of 1’s.Example:Input: S = “10101”, N = 5,  X = 1, Y = 2Output: 3Explanation: The longest substring with at most 1 zero…

## Calculate GCD of all pairwise sum of given two Arrays

Given two arrays A and B of size N and M calculate GCD of all pairwise sum of (A+B) 1<=i<=N and 1<=j<=M.Examples: Input: A = {1, 7, 25, 55}, B = {1, 3, 5}Output: 2Explaination: The GCD of all pairwise sum of (A+B) is equals to …

## Minimize operations to make all elements equal by replacing left half of Subarray with right half

Given an array arr of length N, the task is to find the minimum operations to make all the array elements equal where in each operation:Choose any value K any subarray of even length 2*K. Replace the left half of the subarray by the right…

## How to Convert Your MOV to MP4 Videos for Free

MOV is actually a commonly used video format, you can find it as the default video format of Apple devices, like iPhone and iPad; and DJI Drone, Canon, GoPro, and other cameras. Videos in MOV format are always in high resolution,…

## Longest substring whose any non-empty substring not prefix or suffix of given String

Given a string S of length N, the task is to find the length of the longest substring X of the string S such that:No non-empty substring of X is a prefix of S.No non-empty substring of X is a suffix of S.If no such string is possible, print…

## Maximize first element of Array by deleting first or adding a previously deleted element

Given an array arr of size N, and an integer K, the task is to maximize the first element of the array in K operations where in each operation:If the array is not empty, remove the topmost element of the array.Add any one of the previously…

## Count ways to reach the Nth stair | Set-2

There are N stairs, a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs at a time. Count the number of ways, the person can reach the top.Nth-stairsExamples: Input: N = 1Output:…

## Count of numbers in range [L, R] with only 2 or 7 as prime factors

#include <bits/stdc++.h>using namespace std;  pair<int,int> SpecialorRegular(int L, int R){    int regular = 0, special = 0, temp, i, j;    vector<int>factors;              if(L > R || L < 0|| R < 0)    return…