This question can be done using multiple approaches. Two of them are:
1) Iterating and finding the length and then finding the index of the middle node by dividing it by 2
2) Using slow and fast pointers.
Second approach is better as it causes pointers to iterate over the list only once.
Link to the problem: https://leetcode.com/problems/delete-...
Смотрите видео Delete the middle node of a linked list | Leetcode | Medium | Java онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь AlgorithmHQ 22 Август 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 357 раз и оно понравилось 19 людям.