Move all Negative Numbers to Beginning and Positive to End with Constant Extra Space

Suppose you have an array of integers. It consists of both negative and positive numbers and the problem statement asks to shift/move all the negative and positive elements to the left of the array and to the right of the array respectively without using extra space. Example  Input: arr[]={2,4,-10,13,-7,-60,52,8,-19 } …

Read moreMove all Negative Numbers to Beginning and Positive to End with Constant Extra Space

Print Fibonacci sequence using 2 variables

Problem Statement The problem “Print Fibonacci sequence using 2 variables” states that you need to print the Fibonacci sequence but there is a limitation of using only 2 variables. Example n = 5 0 1 1 2 3 5 Explanation The output sequence has the first five elements of the …

Read morePrint Fibonacci sequence using 2 variables