Skip to content

LeenaMondal01/stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

class Solution{ public: int isStackPermutation(int N,vector &A,vector &B){ stack st; int i=0,j=0; while(j<N) { while(i<N && (st.empty() || st.top()!=B[j])) { st.push(A[i]); i++; } while(!st.empty() && st.top()==B[j]) { st.pop(); j++; } if(i==N && !st.empty() && st.top()!=B[j]) return 0; } return 1; } };

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages