## Find the element which appears maximum number of times in the array.

Objective: Given an array of integers, write a algorithm to find the element which appears maximum number of times in the array. Example: int [] arrA = {4, 1, 5, 2, 1, 5, 9,...

Objective: Given an array of integers, write a algorithm to find the element which appears maximum number of times in the array. Example: int [] arrA = {4, 1, 5, 2, 1, 5, 9,...

Objective: Given an array of integers, find out duplicates in it. Example: int [] a = {4, 6, 2, 1, 2, 5}; Output: Array has duplicates : 2 int a [] = {1, 6,...

Objective: Given a string, write an algorithm to find the last non repeating character in it. Example: String input = “algorithms tutorials” Output: ‘u’ String input = “aabbccdd” Output: No repeating character found. Approach:...

Objective: Given a string, write an algorithm to find the last repeating character in it. Example: String input = “horizon tutorials” Output: ‘i’ String input = “algorithms” Output: No repeating character found. Approach: Naive...

Objective: Given a string, write an algorithm to find the first non repeating character in it. Example: String input = ” tutorial horizon” Output: ‘u’ String input = “aabbccadd” Output: No non-repeating character found....

Objective: Given a string, write an algorithm to find the first repeating character in it. Example: String input = “horizon tutorials” Output: ‘o’ String input = “algorithms” Output: No repeating character found. Approach: Naive...

Objective: Given two dimensional matrix, write an algorithm to find out the snake sequence which has the maximum length. There could be many snake sequence in the matrix, you need to return the one...

Objective: Given two dimensional matrix, write an algorithm to count all possible paths from top left corner to bottom-right corner. You are allowed to move only in two directions, move right OR move down....

Objective: Given a array, write an algorithm to reverse the array. Example: int a[] = {1, 2, 3, 4, 5} Output: {5, 4, 3, 2, 1} Approach: It’s obvious that you cannot use any...

Objective: Given two dimensional matrix, write an algorithm to print all the diagonals of matrix. Example: Approach: We will solve this problem in two parts. first half of diagonals and second half of diagonals....

Objective: Given two strings, s1 and s2 and edit operations (given below). Write an algorithm to find minimum number operations required to convert string s1 into s2. Allowed Operations: Insertion – Insert a new...

Objective: In this game, which we will call the coins-in-a-line game, an even number, n, of coins, of various denominations from various countries, are placed in a line. Two players, who we will call...

Objective: You are given a set of n types of rectangular 3-D boxes, where the i^th box has height h(i), width w(i) and depth d(i) (all real numbers). You want to create a stack...

Objective: You are given a large string. You need to cut the string into chunks such that each substring that you get is a palindrome. Remember that each 1 length string is always a...

%d bloggers like this: