How to identify problems to implement the stack data structure -
- Most of the question based on Array or Heap.
- In brute force O(n2) when one loop is dependent on another loop.
for i in range(n):
for j in range(i, n):- Here
jis going either0toi,ito0,itonorntoi.