# Category: Uncategorized

## Find the first repeating character in a given string

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

## Dynamic Programming — 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,…

## Binary Tree-Inorder Traversal — Non Recursive Approach

Objec­tive: Given a binary tree, write a non recur­sive or iter­a­tive algo­rithm for Inorder tra­ver­sal. Exam­ple: Ear­lier we have seen “What is Inorder tra­ver­sal and recur­sive algo­rithm for it”, In this arti­cle we will…

## Dynamic Programming — Longest Common Subsequence

Objec­tive: Given two string sequences, write an algo­rithm to find the length of longest sub­se­quence present in both of them. These kind of dynamic pro­gram­ming ques­tions are very famous in the inter­views like Ama­zon, Microsoft,…

## OR Print in Spiral Pattern">Level Order Traversal in Zig Zag pattern OR Print in Spiral Pattern

Objec­tive: Given a binary Tree, Do Level Order Tra­ver­sal in Zig Zag pat­tern OR Print in Spi­ral Input: A Binary Tree Out­put: Order Tra­ver­sal in Zig Zag pat­tern OR Print in Spiral.

## Find a pair of numbers from an array whose sum equals k

Objec­tive: Write an algo­rithm to find out whether in a given array there exists or not two num­bers whose sum is exactly equals to a given num­ber. This prob­lem has been asked in Amazon…