-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add minTime solutions in Python, C++, and Go for LC problem #3604 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR introduces new implementations of the minTime function for LC problem doocs#3604 in Python, C++, and Go, each leveraging a priority-queue-based Dijkstra variant that respects edge time windows to compute the minimum travel time or return -1 if unreachable. Class diagram for Go solution: minTime and supporting typesclassDiagram
class Item {
int value
int priority
int index
}
class PriorityQueue {
+Len() int
+Less(i, j int) bool
+Swap(i, j int)
+Push(x any)
+Pop() any
}
class minTime {
+minTime(n int, edges [][]int) int
}
minTime ..> PriorityQueue : uses
PriorityQueue o-- Item : holds
Class diagram for C++ solution: Solution classclassDiagram
class Solution {
- vector<vector<vector<int>>> adj
- vector<int> sol
- priority_queue<pair<int,int>, vector<pair<int,int>>, greater<>> pq
- void pushNeighbours(int node, int curr)
+ int minTime(int n, vector<vector<int>>& edges)
}
Class diagram for Python solution: Solution classclassDiagram
class Solution {
+minTime(n: int, edges: List[List[int]]) -> int
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Speccy-Rom - I've reviewed your changes - here's some feedback:
- Add the required imports (List, inf from math, and heapq) to the Python snippet so it’s runnable as-is.
- The C++ solver’s atexit hook writing to display_runtime.txt/display_memory.txt seems unrelated to the algorithm and could be removed or documented separately.
- You currently have two Go implementations (in the README and Solution.go); consider consolidating into a single source to reduce duplication.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add the required imports (List, inf from math, and heapq) to the Python snippet so it’s runnable as-is.
- The C++ solver’s atexit hook writing to display_runtime.txt/display_memory.txt seems unrelated to the algorithm and could be removed or documented separately.
- You currently have two Go implementations (in the README and Solution.go); consider consolidating into a single source to reduce duplication.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Introduce new solutions for "Minimum Time to Reach Destination in Directed Graph" (LeetCode 3604) in Python, C++, and Go, and update documentation to reflect these additions
New Features:
Documentation: