You are given a circle list of doors. Each door has 'close' and 'open' methods. You need to count how many doors exist in the circle (without using == or equals).
In a directed graph, each node is assigned an uppercase letter. We define a path's value as the number of most frequently-occurring letter along that path. For example, if a path in the graph goes through "ABACA", the value of the path is 3, since there are 3 occurrences of 'A' on the path.
Given a graph with n nodes and m directed edges, return the largest value path of the graph. If the largest value is infinite, then return null.
The graph is represented with a string and an edge list. The i-th character represents the uppercase letter of the i-th node. Each tuple in the edge list (i, j) means there is a directed edge from the i-th node to the j-th node. Self-edges are possible, as well as multi-edges.
ברשותך שני פתילים. ידוע לך שמן הרגע שהדלקת את קצהו של אחד הפתילים, הוא יבער במשך שעה אחת בדיוק. קצב הבעירה אינו אחיד (כלומר- חצי פתיל לא בהכרח יבער במשך חצי שעה). מדוד שלושת רבעי השעה בעזרת שני הפתילים.
תשובות
הוסף תשובה
|
לצפיה בתשובות
אוקטובר 2022
מדליקים את הפתילה הראשונה משתי הצדדים ואת הפתילה השניה רק מצד אחד. כשהפתילה הראשונה מתכבה מדליקים גם את הצד השני של הפתילה השניה.