Leetcode 2285 - Maximum Total Importance of Roads [28/6/24]
HTML-код
- Опубликовано: 26 июн 2024
- Time Taken: ~5 mins
Tag: LeetCode Medium
Basic ideas:
Get frequency of each node appearing
Sort frequency in ascending order
Iterate through frequency vector and assign importance in ascending order starting from 1. Accumulate to ans to calculate the total maximal importance.