Given a square matrix, print maximum length snake sequence in it. A Snake sequence is defined as a sequence of numbers where each new number, which can only be located to the right or down of the current number, is either plus or minus one.
Given an binary array of size two having alteast one element as zero, write a single line function to set both its elements to zero. Use of ternary operator and direct assignment of elements are not allowed.
In k-partition problem, we need to partition an array of positive integers into k disjoint subsets that all have equal sum and they completely covers the set.
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.