## Sum of all sub arrays in O(n) Time

Objective: Given an array write an algorithm to find the sum of all the possible sub-arrays. Example: int [] a = {1, 2, 3}; Output: Possible subarrays – {1}, {2}, {3}, {1, 2} , {2,...

Skip to content# Category: Bloomberg

## Sum of all sub arrays in O(n) Time

## Dynamic Programming – Egg Dropping Problem

## Swap two numbers without using extra variable

## Stock Single Sell Problem – O(n) Solution

## Maximum Subarray OR Largest Sum Contiguous Subarray Problem – Divide and Conquer

## Dynamic Programming – Count all paths in 2D Matrix with Obstructions in it

## Dynamic Programming – Maximum Subarray Problem

## Kadane’s Algorithm – Maximum Subarray Problem

## Single Threaded Binary Tree Complete Implementation

## Generate Maximum revenue by selling K tickets from N windows

@tutorialhorizon

Objective: Given an array write an algorithm to find the sum of all the possible sub-arrays. Example: int [] a = {1, 2, 3}; Output: Possible subarrays – {1}, {2}, {3}, {1, 2} , {2,...

Objective: There are n number of eggs and building which has k floors. Write an algorithm to find the minimum number of drops is required to know the floor from which if egg is dropped,...

Objective: Write an algorithm to swap two numbers without using extra variable. This is fun puzzle which is asked in the interview. Approach: Example: a = 3, b = 5 a = a + b...

Objective: Given an array represents cost of a stock on each day. You are allowed to buy and sell the stock only once. Write an algorithm to maximize the profit in single buy and sell....

Objective: The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum. Example: int [] A = {−2, 1, −3, 4, −1, 2, 1, −5, 4}; Output:...

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: The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum. Example: int [] A = {−2, 1, −3, 4, −1, 2, 1, −5,...

Objective: The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum. Example: int [] A = {−2, 1, −3, 4, −1, 2, 1, −5,...

In earlier article “Introduction to Threaded Binary Tree” we have seen what is threaded binary tree, types of it and what advantages it has over normal binary tree. In this article we will see...

Objective: Given ‘N’ windows where each window contains certain number of tickets at each window. Price of a ticket is equal to number of tickets remaining at that window. Write an algorithm to sell...

%d bloggers like this: