# Category: Goldman Sachs

## Reverse the given Array without using built in function

Objec­tive: Given a array, write an algo­rithm to reverse the array. Exam­ple: int a[] = {1, 2, 3, 4, 5} Out­put: {5, 4, 3, 2, 1} Approach: It’s obvi­ous that you can­not use any built-in…

## 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,…

## Find the Height of a tree without Recursion

Objec­tive: — Find the Height of a tree with­out Recur­sion. In our ear­lier post “Height of tree” we had used recur­sion to find it. In this post we will see how to find it…

## OR Height of a Binary Tree">Find the Maximum Depth OR Height of a Binary Tree

Objec­tive: Given a binary tree, find the height of it Input: A Binary Tree Out­put: Height of a binary tree Exam­ple: Approach:

## Find the Loop in a Linked list, find its length and Break the Loop

Objec­tive: In a given linked list, check whether it con­tains the loop in it, if yes then find the Loop length and break the loop. Loop in a linked list means the last node does…