Shuffle 2n integers as a1-b1-a2-b2-a3-b3-..bn without using extra space

Problem Statement You are given an array of integers. The problem “Shuffle 2n integers as a1-b1-a2-b2-a3-b3-..bn without using extra space” asks to shuffle all the numbers in the array such that the numbers which are like (x0, x1, x2, x3, y0, y1, y2, y3) will be shuffled like x0, y0, …

Read more

Implement Stack and Queue using Deque

Problem Statement The problem “Implement Stack and Queue using Deque” states to write an algorithm to implement Stack and Queue using a Deque(Doubly Ended Queue). Example (Stack) Push(1) Push(2) Push(3) Pop() isEmpty() Pop() Size() 3 false 2 1 Example (Queue) Enqueue(1) Enqueue(2) Enqueue(3) Dequeue isEmpty() Size() Dequeue() 1 false 2 …

Read more

Count quadruples from four sorted arrays whose sum is equal to a given value x

Problem Statement Problem “Count quadruples from four sorted arrays whose sum is equal to a given value x” state that you are given four integer arrays and a value called x. The problem statement asks to find out how many quadruplets can be formed of which sum of elements of …

Read more

Translate »