# Category: Software Engineer In Test

## Check if Array Contains All Elements Of Some Given Range

Objective: Given an array of unsorted numbers, check if it contains all elements of some given range. Examples: int[] arrA = { 11, 17, 13, 19, 15, 16, 12, 14 }; Range : 12-15...

## Check if Array is Consecutive Integers

Objective: Given a array of unsorted numbers, check if all the numbers in the array are consecutive numbers. Examples: int [] arrA = {21,24,22,26,23,25}; – True (All the integers are consecutive from 21 to...

## In an Array, find the Contiguous Subarray with Sum to a Given Value.

Objective: Given an array 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 =...

## Find intersection between Two Sorted Arrays.

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:...

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

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.

## Inorder Successor in Binary Tree

Algorithms – Inorder Successor in Binary Tree Objective: Given a Binary tree (Not binary Search Tree ), find the inorder successor of a node. What is Inorder Successor: Inorder successor of a node is...

## Sorted Array to Binary Search Tree of Minimal Height

Objective: Given a sorted array with unique elements, Create a binary search tree with minimal height. Why minimal height is important : We can do the linear scan to the array and make the...

## Get the Height of a Node in a Binary Tree

Objective: Given a binary tree, find the height of a given node in the tree. Input: A Binary Tree and a node Output: Height of a given node in the tree. Example: Approach:

## Reverse the binary representation of a number.

Objective: Write a program to Reverse the binary representation of a number Example: Input : 30 Output : 15 Explanation: binary representation of 30 is : 11110 reverse of binary representation : 01111 decimal...

## Delete a Node in the Middle of a linked list, Given only access to that Node

Objective: Write a program to Delete a Node in the Middle of a linked list, Given only access to that Node Example: Original List : ->1->2->8->3->7->0->4 After Deleting the mid node (say 7) :...

## Find the n’th Node from the end of a given Linked List

Objective: Given a linked list and integer ‘n’, write an algorithm to find the nth node from the end in the Linked List. Example: Original List : ->1->2->8->3->7->0->4 Output : 3rd Element from the...

## Check if one string is Rotation of another string

Objective: Write an algorithm to check if one string is Rotation of another string. This question has been asked in the Amazon interview. Example: Input Strings : ‘sumitjain’ and ‘tjainsumi’ Output : true Input...