Harbor Signal Expansion Test
Think of a small harbor challenge where order and timing really matter. In Harbor Signal Expansion Test, you are trying to work toward the right number by following one clear idea.
Here, you are mostly deciding whether a rule stays true while you look through the input. Sometimes that means checking if things are connected, balanced, or allowed. Sometimes it means noticing the first place where the rule breaks. The answer depends on being careful from beginning to end.
For example, if the input is n = 5, links = [[0,1],[1,2],[2,3],[3,4]], start = 3, maintenance = [], the answer is 5. All towers are online, so the signal covers every lighthouse. Another example is n = 6, links = [[0,1],[1,2],[2,3],[3,4],[4,5]], start = 0, maintenance = [3], which gives 4. Towers 0, 1, 2, and 5 remain online; cable through tower 3 prevents reaching tower 4.
This is a friendly practice problem, but it still rewards careful reading. The key is noticing the exact moment when the rule stays true or breaks.
Example Input & Output
All towers are online, so the signal covers every lighthouse.
Towers 0, 1, 2, and 5 remain online; cable through tower 3 prevents reaching tower 4.
Maintenance disables the only connecting cables, so the broadcast stays at the starting lighthouse.
Algorithm Flow

Best Answers
import java.util.*;
class Solution {
public boolean has_segment_sum(int[] signals, int k) {
Set<Integer> seen = new HashSet<>();
seen.add(0);
int current = 0;
for (int x : signals) {
current += x;
if (seen.contains(current - k)) return true;
seen.add(current);
}
return false;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
