Category: Array

Right rotate an array k times

In this post, we will see how to right rotate an array by specified positions. For example, right rotating the array { 1, 2, 3, 4, 5, 6, 7 } three times will result in the array { 5, 6, 7, 1, 2, 3, 4 }.

Left rotate an array in C

In this post, we will see how to left rotate an array by specified positions. For example, left rotating the array { 1, 2, 3, 4, 5 } twice results in the array { 3, 4, 5, 1, 2 }.

Print all distinct Subsets of a given Set

Given a set S, generate all distinct subsets of it i.e., find distinct power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.  

3-Partition Problem

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.