Загрузка...

Codeforces Friends Or Not - Logic To Solve This Problem Explained With Whiteboarding & Examples

Codeforces Friends Or Not - Logic To Solve This Problem Explained With Whiteboarding & Examples.

If you find this video helpful, please 'Like' & 'Subscribe'.
This is really helpful for the channel and also motivates me to do more of such good videos.

Problem Link : https://codeforces.com/problemset/problem/159/A

Problem Description:

Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends manually! Pairs of friends are deduced in the following way. Let's assume that user A sent user B a message at time t1, and user B sent user A a message at time t2. If 0 less than t2 - t1 less than or equal to d, then user B's message was an answer to user A's one. Users A and B are considered to be friends if A answered at least one B's message or B answered at least one A's message.

You are given the log of messages in chronological order and a number d. Find all pairs of users who will be considered to be friends.

Youtube channel: https://www.youtube.com/channel/UCrvpRH4lSRjp2T6btl0lf4w

https://github.com/maksrane100/codeforces_solutions
https://github.com/maksrane100/leetcode_solutions

#coding #softwareengineer #Leetcode #Algorithm #DataStructure #Java #programmer #tech #software #codinglife #Preparation
#interview #programminglife #programmingisfun #leetcode #codeforces #algorithm #algorithms #datastructure #datastructuresandalgorithms

Видео Codeforces Friends Or Not - Logic To Solve This Problem Explained With Whiteboarding & Examples канала AlgorithmicIQ
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять