HackerRank
HackerRank copied to clipboard
Solution based on O(n log (n))
The current solution is O(n*m) which is sub-optimal. Based on @RyanFehr 's Java solution, this would be more efficient. In addition, it appears to me that sorting is superfluous in the current code.