THE_ALGORITHMS Telegram 4872
Сумма трёх целых чисел

Проблема: Дан целочисленный массив nums. Необходимо реализовать алгоритм, который вернет все тройки [nums[i], nums[j], nums[k]], где nums[i] + nums[j] + nums[k] == 0, и индексы i, j и k различны.

Вывод не должен содержать повторяющихся троек. Можно вернуть результат и тройки в любом порядке.

Пример 1:
Input: nums = [-1,0,1,2,-1,-4]
Output:
[[-1,-1,2],[-1,0,1]]
Объяснение:
nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0
.
nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0.
nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0.

Пример 2:
Input: nums = [0,0,0]
Output:
[[0,0,0]]



tgoop.com/the_algorithms/4872
Create:
Last Update:

Сумма трёх целых чисел

Проблема: Дан целочисленный массив nums. Необходимо реализовать алгоритм, который вернет все тройки [nums[i], nums[j], nums[k]], где nums[i] + nums[j] + nums[k] == 0, и индексы i, j и k различны.

Вывод не должен содержать повторяющихся троек. Можно вернуть результат и тройки в любом порядке.

Пример 1:
Input: nums = [-1,0,1,2,-1,-4]
Output:
[[-1,-1,2],[-1,0,1]]
Объяснение:
nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0
.
nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0.
nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0.

Пример 2:
Input: nums = [0,0,0]
Output:
[[0,0,0]]

BY Алгоритмы и структуры данных




Share with your friend now:
tgoop.com/the_algorithms/4872

View MORE
Open in Telegram


Telegram News

Date: |

bank east asia october 20 kowloon The group also hosted discussions on committing arson, Judge Hui said, including setting roadblocks on fire, hurling petrol bombs at police stations and teaching people to make such weapons. The conversation linked to arson went on for two to three months, Hui said. As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces. In the “Bear Market Screaming Therapy Group” on Telegram, members are only allowed to post voice notes of themselves screaming. Anything else will result in an instant ban from the group, which currently has about 75 members. So far, more than a dozen different members have contributed to the group, posting voice notes of themselves screaming, yelling, groaning, and wailing in various pitches and rhythms.
from us


Telegram Алгоритмы и структуры данных
FROM American