Count the Number of Houses at a Certain Distance I | Why Graph | Leetcode 3015 | Weekly Contest
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 43rd Video of our Playlist "Graphs : Popular Interview Problems".
In this video we will try to solve two very good Graph problem - Count the Number of Houses at a Certain Distance I (Leetcode 3015)
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Count the Number of Houses at a Certain Distance I (Leetcode 3015)
Company Tags : will update soon
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Floyd%20Warshall/Count%20the%20Number%20of%20Houses%20at%20a%20Certain%20Distance%20I.cpp
Leetcode Link : https://leetcode.com/problems/count-the-number-of-houses-at-a-certain-distance-i/
My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Approach Summary : The purpose of this method is to calculate and return a vector representing the count of pairs of nodes in a graph with n nodes based on the Floyd-Warshall algorithm. The graph is initially set up with all pairwise distances set to a large value (100000), except for edges between adjacent nodes, which are set to 1. Additionally, the distances between nodes x and y (and vice versa) are set to 1. The Floyd-Warshall algorithm is then applied to update the distances between all pairs of nodes in the graph. Finally, the method constructs a vector result to store the count of pairs at each distance level. It iterates through all pairs of nodes and increments the corresponding count in the result vector based on the shortest distance between those nodes. The resulting vector is then returned.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
✨ Timelines✨
00:00 - Introduction
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear