Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/// /// You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return

///

/// You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path outgoing to another city.

/// It is guaranteed that the graph of paths forms a line without any loop, therefore, there will be exactly one destination city.

/// Example 1:

/// Input: paths = [["London", "New York"], ["New York","Tampa"], ["Delhi","London"]]

/// Output: "Tampa"

/// Explanation: Starting at "Delhi" city you will reach "Tampa" city which is the destination city.Your trip consist of: "Delhi" -> "London" -> "New York" -> "Tampa".

/// Input: paths = [["B","C"],["D","B"],["C","A"]]

/// Output: "A"

/// Explanation: All possible trips are:

/// "D" -> "B" -> "C" -> "A".

/// "B" -> "C" -> "A".

/// "C" -> "A".

/// "A".

/// Clearly the destination city is "A".

///

///

/// The destination city string

private static string DestCity(string[,] paths)

{

try

{

// write your code here.

return "";

}

catch (Exception)

{

throw;

}

}

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

How do members envision the ideal team?

Answered: 1 week ago

Question

Has the team been empowered to prioritize the issues?

Answered: 1 week ago

Question

Have issues been prioritized?

Answered: 1 week ago