@atul_21 I think if we compare both of these approaches.
For 1st => exact complexity => (n + 3log(n)) => roughly O(n).
For 2nd => exact => 3n => roughy O(n).
So both of the approaches are giving O(n) but we have to choose the closest. Then we should choose 1st approach as n + 3log(n) < 3n.