Approach

Approach-1

Approach-2