Move all Negative Numbers to Beginning and Positive to End with Constant Extra Space

Suppose you have an array of integers. It consists of both negative and positive numbers and the problem statement asks to shift/move all the negative and positive elements to the left of the array and to the right of the array respectively without using extra space. Example  Input: arr[]={2,4,-10,13,-7,-60,52,8,-19 } …

Read moreMove all Negative Numbers to Beginning and Positive to End with Constant Extra Space

Find if there is a subarray with 0 sum

The problem “Find if there is a subarray with 0 sum” states that you are given an integer array containing negative integers as well. The problem statement asks to determine if any sub-array of size at-least 1. This sub-array should have a sum equal to 1. Example arr[] = {2,1,-3,4,5} …

Read moreFind if there is a subarray with 0 sum

Count items common to both the lists but with different prices

Problem Statement You are given two lists. Each of which index contains the name of the item and its price. The problem statement asks to count items common to both the lists but with different prices, which is to find out how many numbers of items are common in both …

Read moreCount items common to both the lists but with different prices

Identify and Mark Unmatched Parenthesis in an Expression

In identify and mark unmatched parenthesis in an expression problem, we have given a string s of length n containing an expression. Find the balanced pair of parenthesis and replace all the balanced opening parenthesis as 0, the balanced closing parenthesis as 1 and the unbalanced parenthesis as -1. Example …

Read moreIdentify and Mark Unmatched Parenthesis in an Expression