You are given an undirected graph and two vertices, source and destination. Your task is to determine whether a path exists between them.
Return true if a path exists; otherwise, return false.
Input: V = 6, edges = [[0,1],[0,2],[3,5],[5,4],[4,3]], source = 0, destination = 5
Output: false
Explanation: There is no path between vertices 0 and 5.
Input: V = 3, edges = [[0,1],[1,2]], source = 0, destination = 2
Output: true
Explanation: A path exists from vertex 0 to vertex 2.
Input: V = 1, edges = [], source = 0, destination = 0
Output: true
Explanation: The source and destination are the same vertex.
Sign in to write, run, and submit your solution against the full test suite.