Question 1. Is it ok if We use a higher-order function like map, filter, reduce to avoid nested loop?
Question 2. Is HOF is more efficient in time complexity stuff?
Question 1. Is it ok if We use a higher-order function like map, filter, reduce to avoid nested loop?
Question 2. Is HOF is more efficient in time complexity stuff?
It's okay, but it's not really "more efficient" it's still essentially a nested operation.
in big O notation, either a nested for to get the data versus a HOF is still O(n^2).