gfg

[Solved] Negative Prefix C++,Java, Python

Negative Prefix

Given an array A[] of N integers. In each operation, Geek can increase the ith element by 1 (i.e set A[i] = A[i]+1 where 1 < i < N).The task is to calculate the minimum number of operations required such that there is no prefix in the array A[] whose sum…

[Solved] Rolling Hash Contest Problem

[Solved] Rolling Hash Contest Problem

You are given a string S and a Pattern P. You need to find all matches of hash of P in string S. Also, print the index (0 based) at which the pattern’s hash is found. If no match is found, print -1. Note: All the matches should have same length as pattern P.…

[Solved] Without Adjacent Contest Problem

[Solved] Without Adjacent Contest Problem

Without Adjacent: Given an array arr[] of N positive integers. The task is to find a subsequence with maximum sum such that there should be no adjacent elements from the array in the subsequence. Without Adjacent Contest Input:First line of…