python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Find all Cycles in the Directed Graph including back edges
Given a graph below, find all the possible path from vertex 1 to come back to 1 including back edges.
Result:
[1,2,3,2,1]
[1,2,1]
[1,2,3,1]
I tried using DFS able to get only...
Arundhathi D
Votes: 0
Answers: 1
What is wrong with this Coin Change solution using DFS with memoization?
I've solved Leetcode's Coin Change 2 problem with a DFS + memoization approach in Python, with the solution below
# O(m*n)
def change(amount: int, coins: List[int]) -> int:
cache = {}
...
user3613025
Votes: 0
Answers: 1
Connected Component in Undirected Graph in python
Find connected component in undirected graph. Each node in the graph contains a label and a list of its neighbors. this is the link: https://www.lintcode.com/problem/431/ Leetcode requires membership ...
Yilmaz
Votes: 0
Answers: 1
How to I code Depth First Search without recurrence
How to implement Depth First Search code in python without recurrence.
I have done it by class and recurrence method.
the following is by recurrence method:
graph1 = {
'A' : ['B','C','F'],
'B' : ['A',...
Red_Haired_Shanks
Votes: 0
Answers: 1