Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us
Hide Buttons

Tagged: Arrays

2

Maximum difference between two elements where larger element appears after the smaller element

Objec­tive: Given an array A[], write an algo­rithm to find Max­i­mum dif­fer­ence between two ele­ments where larger ele­ment appears after the smaller ele­ment or in other words find A[i] and A[j] such that A[j]-A[i]…

0

Find the last non repeating character in a given string.

Objec­tive: Given a string, write an algo­rithm to find the last non repeat­ing char­ac­ter in it. Exam­ple: String input = “algo­rithms tuto­ri­als” Out­put: ‘u’ String input = “aab­bc­cdd” Out­put: No repeat­ing char­ac­ter found. Approach: Naive…

0

Find the last repeating character in a given string.

Objec­tive: Given a string, write an algo­rithm to find the last repeat­ing char­ac­ter in it. Exam­ple: String input = “hori­zon tuto­ri­als” Out­put: ‘i’ String input = “algo­rithms” Out­put: No repeat­ing char­ac­ter found. Approach: Naive approach:…

2D Matrix with Obstructions in it"> 1

2D Matrix with Obstructions in it">Dynamic Programming — Count all paths in 2D Matrix with Obstructions in it

Objec­tive: Given two dimen­sional matrix, write an algo­rithm to count all pos­si­ble paths from top left cor­ner to bottom-right cor­ner. You are allowed to move only in two direc­tions, move right OR move down.…

2

Dynamic Programming — Highway Billboard Problem

Objec­tive:  Sup­pose you’re man­ag­ing con­struc­tion of bill­boards on the Rocky & Bull­win­kle Memo­r­ial High­way, a heav­ily trav­eled stretch of road that runs west-east for M miles. The pos­si­ble sites for bill­boards are given by…

0

Kadane’s Algorithm — Maximum Subarray Problem

Objec­tive:  The max­i­mum sub­ar­ray prob­lem is the task of find­ing the con­tigu­ous sub­ar­ray within a one-dimensional array of num­bers which has the largest sum. Exam­ple: int [] A = {−2, 1, −3, 4, −1, 2, 1, −5,…