Skip to content

Commit 8af1ed4

Browse files
committed
0797-all-paths-from-source-to-target.md Perfected C# code style.
1 parent 007b0b1 commit 8af1ed4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

problems/0797-all-paths-from-source-to-target.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,14 @@ function dfs(node) {
192192

193193
## C#
194194
```c#
195-
public class Solution {
195+
public class Solution
196+
{
196197
IList<IList<int>> paths = new List<IList<int>>();
197198
IList<int> path = new List<int>();
198199
int[][] graph;
199200

200-
public IList<IList<int>> AllPathsSourceTarget(int[][] graph) {
201+
public IList<IList<int>> AllPathsSourceTarget(int[][] graph)
202+
{
201203
this.graph = graph;
202204
path.Add(0);
203205

@@ -206,13 +208,16 @@ public class Solution {
206208
return paths;
207209
}
208210

209-
void dfs(int node) {
210-
if (node == graph.Length - 1) {
211+
void dfs(int node)
212+
{
213+
if (node == graph.Length - 1)
214+
{
211215
paths.Add(path.ToList());
212216
return;
213217
}
214218

215-
foreach (int targetNode in graph[node]) {
219+
foreach (int targetNode in graph[node])
220+
{
216221
path.Add(targetNode);
217222

218223
dfs(targetNode);

0 commit comments

Comments
 (0)