Terminal City of a Directed Travel Line. Each paths entry [from,to] is a directed connection. The connections form one line without a loop, so exactly one city has no outgoing connection.
### Problem
Each paths entry [from,to] is a directed connection. The connections form one line without a loop, so exactly one city has no outgoing connection. Return that destination city; the input connections need not be in travel order.
```cpp
class Solution {
public:
string destCity(vector<vector<string>>& paths);
};
```
### Examples
**Example 1:**
```text
Input: paths = [["Pine","Elm"],["Oak","Pine"]]
Output: "Elm"
Explanation: The directed line is Oak to Pine to Elm.
```
**Example 2:**
```text
Input: paths = [["North","South"]]
Output: "South"
Explanation: South has no outgoing connection.
```
### Constraints
- There are 1 to 100 paths, each containing exactly two different city names.
- Each name has length 1 to 10 and uses uppercase/lowercase English letters or spaces.
- The directed paths form one line with no loop and exactly one destination.
### Contract considerations
The acyclic single-line guarantee supplies uniqueness; no arbitrary graph sink selection is needed.
```hint Read the boundary condition
Account for connections presented out of travel order and for complete city names containing spaces. Use the guaranteed single directed line.
```
### Boundary reminders
The acyclic single-line guarantee supplies uniqueness; no arbitrary graph sink selection is needed.
Overview: Terminal City of a Directed Travel Line. Each paths entry [from,to] is a directed connection. The connections form one line without a loop, so exactly one city has no outgoing connection.
Each paths entry [from,to] is a directed connection. The connections form one line without a loop, so exactly one city has no outgoing connection. Return that destination city; the input connections need not be in travel order.
class Solution {
public:
string destCity(vector<vector<string>>& paths);
};
Examples
Example 1:
Input: paths = [["Pine","Elm"],["Oak","Pine"]]
Output: "Elm"
Explanation: The directed line is Oak to Pine to Elm.
Example 2:
Input: paths = [["North","South"]]
Output: "South"
Explanation: South has no outgoing connection.
Constraints
There are 1 to 100 paths, each containing exactly two different city names.
Each name has length 1 to 10 and uses uppercase/lowercase English letters or spaces.
The directed paths form one line with no loop and exactly one destination.
Contract considerations
The acyclic single-line guarantee supplies uniqueness; no arbitrary graph sink selection is needed.
Boundary reminders
The acyclic single-line guarantee supplies uniqueness; no arbitrary graph sink selection is needed.