# Reversing a Sequence via Stack(s)---If we desire to reverse a given sequence, we can use stacks to reverse the sequence. Stacks are particularly useful if we need to classify the characters based and obtain a reversed sequence.$$sequence = \{ x_1, x_2, t_1, t_2, z_1, z_2, z_3, t_3, x_3 \}$$We can push the elements into category wise stacks:`NOTATION`: $$ stack = \{ top, mid, mid, mid, ..., bottom \} $$We have the following stacks category wise$$ stack_{X} = \{x_3, x_2, x_1\};\space stack_{T} = \{t_3, t_2, t_1\}; \space stack_{Z} = \{z_3, z_2, z_1\} $$As an example, we can construct a sequence similar to the original but is reversed only at a category level.$$\{ e_k \space | \space e_k = top(stack_K) ,\space \{ K \in \{X, T, Z\} \} \} \implies \{ x_3, x_2, t_3, t_2, z_3, z_2, z_1, t_1, x_1 \}$$The example discussed here is the easy question of `LeetCode Bi-Weekly Contest 175`. The implementation (`Accepted`) can be found in this [lc_contest/biweekly_175_easy_reverse_by_type.cc](./lc_contest/biweekly_175_easy_reverse_by_type.cc).