3-partition problem: Given a set S of positive integers, determine if it can be partitioned into three disjoint subsets that all have same sum and they cover S.
In this post, we will see how to sort an array of integers using iterative merge sort algorithm. Merge sort is an efficient sorting algorithm which falls under divide and conquer paradigm and produces a stable sort.
Given an array A which represents a binary tree such that the parent-child relationship is defined by (A[i], i) for every index i in the array A, build binary tree out of it.
Given an unsorted array of integers whose each element lies in range 0 to n-1 where n is the size of the array, rearrange array such that A[A[i]] is set to i for every element A[i] in the array.
Given an array of integers, duplicates appear in it even number of times except two elements which appears odd number of times. Find both odd appearing element without using any extra memory.
Given a positive integer N, find all N-digit binary numbers having more 1’s than 0’s for any prefix of the number.
Given a string and a dictionary of words, determine if string can be segmented into a space-separated sequence of one or more dictionary words.
Given a linear equation of k variables, count total number of possible solutions of it.
Given a binary tree, write an efficient algorithm to invert binary tree.
Given an integer, swap two bits at given positions in binary representation of it.
Given an array representing a Min Heap, convert Min Heap into a Max Heap. The conversion should be done inplace and in linear time.
Given an array, reverse every group of consecutive m elements in given subarray of it.