Suppose you are given with an array filled with all zeroes initially and Q queries. In each of the Q queries, you are given with three integer values L, R and X. You are asked to add the value X in each of the indices from L to R. Now you have to tell the maximum value in the array and at which index ?
You are given two stacks S1 and S2. You have to pic numbers from stack by deleting top element and add them in the resultant sum. The element deleted must be added into the sum. The sum must not exceed the given value of K. Number of elements picked is called score.
You are given an array A of size n and an integer K. You have to count the number of consecutive subsequences of the array A whose elements’ sum is divisible by K.
You are give two strings s and t as input. Objective is to convert s into t by using following two operations only:
1. Append a lowercase English alphabetic letter to the end of the string.
2. Delete the last character in the string. Performing this operation on an empty string results in an empty string.
You have to convert s into t by performing exactly K number of operations.
We are give few containers containing balls of different colors. We can exchange same number of balls between any two containers. Can we reorganize the balls in containers in such a ways, so that all the containers have all balls in it of same color?
An array of integers of size n is given. Find the number of shift operations done if the array is sorted using insertion sort. Basic approach to solve this problem is apply insertion sort on the given array and count the total number of shifts done during the process.
Given array of size n is right rotated k times. Find out the element at ith position in the resultant array. The original “Circular Array Rotation” problem statement is available and Hackerrank.
It is the language of choice for fields like Machine Learning, Social Network analysis, Data Analysis, etc. But there is one more thing about Python – It’s Dead Slow. Read ahead to know the reason to ditch python for competitive coding. And it’s so slow that most platforms for competitive coding add a 5x multiplier to their time limits if the problem is submitted in Python. This means that if the time limit they’ve set for C/C++ submissions if 1.2 secs, the time limit for Python would be 6 secs.
if you’re a fresher, chances are high that the first language you’ll learn to program is in C. I personally consider C to be the mother of all modern day programming languages, mainly because C++ is more or less completely based on C, and Python(yes, The Python programming language too!) is written in C, as well as some of its widely used packages.
Range Sum is a popular problem in competitive programming and technical interviews. Range Sum problem asks sum of the elements in a range in a given array. Naïve approach requires O(N*Q) time which can be improved to be O(N+Q) using Prefix Sum approach. N is the size of the array and Q is the number of queries.