## Find the subarray with sum to a Given Value.

Objective: Given an array (non-negative) and an integer, Find the Subarray whose sum is equal to the given integer. Examples: int[] arrA = { 25, 12, 14, 22, 19, 15, 10, 23 }; Integer...

Skip to content# Author: SJ

## Find the subarray with sum to a Given Value.

## In an Array, find the Smallest Subarray with Sum Greater than the Given Value

## Rearrange Positive and Negative Elements at Alternate Positions in an Array In O(1) Extra Space

## Find intersection between Two Sorted Arrays.

## Find Kth Smallest or Largest element in an Array.

## Given an array arrA[], find the maximum j – i such that arr[j] > arr[i].

## Find All Elements in an Array which appears more than N/K times, N is Array Size and k is a Number.

## Search an Element in a Rotated Sorted Array

## Print All The Nodes Which are X distance from the Given Node

## Print All The Nodes Which are X distance from the Leaf Nodes

## Print All The Nodes Which are X distance from the Root

## Find the Distance between Two Nodes of a Binary Tree.

## Find The Distance From Root To Given Node of a Binary Tree.

## Construct a binary tree from given Inorder and Postorder Traversal

## Print the Vertical Sum in binary Tree .

@tutorialhorizon

Objective: Given an array (non-negative) and an integer, Find the Subarray whose sum is equal to the given integer. Examples: int[] arrA = { 25, 12, 14, 22, 19, 15, 10, 23 }; Integer...

Objective: Given an array and an integer, find the smallest subarray whose sum is greater than the given integer. Examples: arrA[] = { 1, 5, 20, 70, 8} Integer = 97 Output : Min...

Objective: Given an array arrA[] which has negative and positive elements, rearrange the array in such a manner that positive and negative elements occupy the alternate positions and if there are extra positive or...

Objective: Given two sorted arrays, Find intersection point between them. Examples: int[] a = { 1, 2, 3, 6, 8, 10 }; int[] b = { 4, 5, 6, 11, 15, 20 }; Output:...

Objective: Find Kth Smallest or Largest element in an Array Example: int[] arrA = { 2, 3, 11, 16, 27, 4, 15, 9, 8 }; Output: The 4th smallest element is : 8 Approach:...

Objective: Given an array arrA[], find the maximum j – i such that arr[j] > arr[i]. Example: int[] arrA = { 12, 3, 1, 5, 6, 4, 10, 9, 8, 0 }; Output: Max(j-i)...

Objective: Given an array of size of N and number k. Find all elements in an Array which appears more than N/K times. Input: Array [] and number k. Example: int[] arrA = {...

Input: Rotated Sorted Array. What is Rotated Sorted Array. A sorted array is rotated around some pivot element. See the Example Below, array is rotated after 6. Approach:

Objective: – Given Binary Tree, Print All The Nodes Which are X distance from the Given Node. Example : Approach: Quite Tricky solution, i will explain using the example given in the picture.

Objective: – Given Binary Tree, Print All The Nodes Which are X distance from the Leaf Nodes Example : Approach:

Objective: – Given Binary Tree, Print all the nodes which are X distance from the root Example : Appraoch:

Objective: – Given nodes in a binary tree, find the distance between them. Example : Approach:

Objective: – Find The Distance From Root To Given Node of a binary tree. What does Distance means : It means number of edges between two nodes. Approach:

Objective: – Given a inorder and postorder traversal, write an algorithm to construct a binary tree from that. This problem was asked in the Microsoft coding competition. Input: Inorder and postorder traversals Similar Problems:...

Objective: – Given a binary tree, print it in vertical order sum What is Vertical Order Sum as you can see in the example above, [4],[2], [12],[3],[7] are the vertical order sum of the...

%d bloggers like this: