Leetcode 2037 - Minimum Number of Moves to Seat Everyone [13/6/24]

Поделиться
HTML-код
  • Опубликовано: 11 июн 2024
  • Time Taken: ~5 mins
    Tag: LeetCode Easy
    Basic ideas: (Sorting, Greedy)
    Sort seats vector and students vector
    Get the difference between each index’s value
    Tip: Greedy works here since by greedily moving the current leftmost student to the leftmost desired seat, we can ensure that we can achieve the smallest possible distance we can fill up the desired seats

Комментарии •