## Find top three repeated in array

The problem “Find top three repeated in array” states that you are given an array of n numbers with some repeated numbers in it. Your task is to find out the top 3 repeated numbers in an array. Example   [1,3,4,6,7,2,1,6,3,10,5,7] 1 3 6 Explanation Here 1,3 and 6 are repeated …

## First element occurring k times in an array

We have given a number ‘k’ and an integer array. The problem “First element occurring k times in an array” says to find out the first element in the array which occurs exactly k times in an array. If there is no element in the array which occurs k times …

## Remove duplicates from sorted array

Problem Statement   “Remove duplicates from sorted array” states that you are given a sorted array of size N. You need to remove the duplicate elements from the array. Print the array containing unique elements after the removal of duplicate elements. Example   a [] = {1, 1, 1, 1} {1} Explanation: …

## Reverse words in a string

Problem Statement   “Reverse words in a string” states that you are given a string s of size n. Print the string in reverse order such that the last word becomes the first, second last becomes the second, and so on. Hereby string we refer to a sentence containing words instead …

## Check if Two Expressions With Brackets are Same

Given two strings s1 and s2 representing expressions containing addition operator, subtraction operator, lowercase alphabets, and parenthesis. Check if two expressions with brackets are the same. Example   Input  s1 = “-(a+b+c)” s2 = “-a-b-c” Output  Yes Input  s1 = “a-b-(c-d)” s2 = “a-b-c-d” Output No Algorithm to Check if Two …

## Check for Balanced Parentheses in an Expression

Given a string s of length n. Check whether there is a closing parenthesis for every opening parentheses i.e. if all the parentheses are balanced. In other words, we can also say that, if we have a ‘}’, ‘)’ and ‘]’ for every ‘{‘, ‘(‘ and ‘[‘ respectively, the expression …

## Balanced Expression with Replacement

In Balanced Expression with Replacement problem we have given a string s containing parenthesis i.e. ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{‘, ‘}’. The string also contains x at some places as a replacement of parenthesis. Check if the string can be converted into an expression with valid parenthesis after replacing all …

## Rotate Array

Rotate array is a problem in which we have given an array of size N. We have to rotate the array in the right direction. Each element shift by one position right and last element of the array come to the first position. So, we have given a value K …

## Count Possible Triangles

Problem Statement   In count possible triangles problem we have given an array of n positive integers. Find the number of triangles that can be formed using three different elements of the array as the sides of a triangle. Note: The condition of the triangle is the sum of two sides … 