×
Detail Form
We will send your result on your email id and phone no. please fill detail
Given an array, A of size N consisting of elements 1 to N. A boolean array B consisting of N-1 elements indicates that if B[i] is 1, then A[i] can be swapped with A[i+1].
Find out if A can be sorted by swapping elements.
Reverse a Stack without using recursion and extra space. Even the functional Stack is not allowed.
Examples:
Input : 1->2->3->4 Output : 4->3->2->1 Input : 6->5->4 Output : 4->5->6