- Data Structures, interview-preparation, Microsoft, Stack

Check if two Stacks are equal or not without alteration

  import java.util.*;  class GFG {          static String compareStacks(        Stack s1,        Stack s2)    {                int N = s1.size();                  int M = s2.size();                  if (N != M) {            return “No”;        }                  for (int i = 1; i