Coral Pulse Count
In the Lumina Reef, marine biologists track the "pulse" of different coral sections recorded as integers. Your task in Coral Pulse Count is to take an array of pulse readings and return a new array where the pulses are sorted in ascending order. This helps spotting health patterns at a glance!
The "secret sauce" is Non-Destructive Sorting. You must return a brand-new array, leaving the original sensor log untouched for archival. The pulse readings can include duplicates for stable sections and negative values for "dormant" areas. Your routine must preserve every single entry, merely rearranging them from lowest to highest. If the reef is already orderly, just return a clean, sorted copy. This simple transformation turns a chaotic log into a professional data summary for the research team instantly!
If sorting is part of the strategy, do it intentionally as a preprocessing step to simplify downstream logic such as merging, ordering, or comparison. After sorting, keep output semantics precise: preserve expected structure, avoid dropping valid entries, and ensure tied cases still follow deterministic order rules.
Examples
The first ripple adds one pulse and repeats the earlier glow three times.
Three layers maintain the rule, producing forty pulses when the celebration ends.
Only the initial coral emits light.
Algorithm Flow

Best Answers
class Solution {
public int coral_pulse_count(Object layers) {
int n = layers instanceof Integer ? (int) layers : 0;
if (n == 0) return 1;
int pulses = 1;
for (int i = 0; i < n; i++) {
pulses = 1 + 3 * pulses;
}
return pulses;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this problem.
