There are lot of ways of implementing any given logic. It is what clicked your mind at the very right moment & you are able to implement is successfully 
Can you please show any code snippet of implementing it using your way?
Cheers,
AB

Can you please show any code snippet of implementing it using your way?
Cheers,
AB

