Check whether a directed graph is Eulerian

An Eulerian trail (or Eulerian path) is a path in a graph that visits every edge exactly once. Given a directed graph, check whether it has an Eulerian path or not.

Find the minimum number of merge operations to make an array palindrome

Given a list of non-negative integers, find the minimum number of merge operations to make it a palindrome. A merge operation can only be performed on two adjacent elements. The result of a merge operation is that the two adjacent elements are replaced with their sum.

Construct a complete binary tree from its linked list representation

Given a linked list, construct a complete binary tree from it. Assume that the order of elements present in the linked list is the same as that in the complete tree’s array representation.

Find read-write conflicts among given database transactions

Given a list of database transactions, find all read-write conflicts among them. Assume that there is no strict two-phase locking (Strict 2PL) protocol to prevent read-write conflicts.

Check if removing an edge can split a binary tree into two equal size trees

Given a binary tree, check if removing an edge can split it into two binary trees of equal size.

In-place merge two height-balanced BSTs

Given two height-balanced binary search trees, in-place merge them into a single balanced binary search tree. For each node of a height-balanced tree, the difference between its left and right subtree height is at most 1.

New Men's Stone Coule Hausr Rip Wheeler Stylish Cowbooy Black Co

Given an array representing the parent-child relationship in a binary tree, find the tree’s height without building it. The parent-child relationship is defined by (A[i], i) for every index i in array A.

Determine whether two nodes lie on the same path in a binary tree

Given a binary tree and two tree pointers, x and y, write an efficient algorithm to check if they lie on the same root-to-leaf path in the binary tree. In other words, determine whether x is an ancestor of y, or x is a descendant of y.

Determine whether a BST is skewed from its preorder traversal

Given an array representing the preorder traversal of a BST, determine whether it represents a skewed BST or not. In a skewed BST, each node’s descendants are either smaller or larger than the node itself.

Find total arrangements such that no two balls of the same color are together

Given r red, b blue, and g green balls, find the total number of arrangements in a row such that no two balls of the same color end up together.

Print all pairs of anagrams in a set of strings

Given a set of strings, print all pairs of anagrams together. Two strings, X and Y, are called anagrams if we can get a string Y by rearranging the letters of the string X and using all the characters of the string X exactly once.

Find the smallest missing positive number from an unsorted array

Given an unsorted integer array, find the smallest missing positive integer in it.