Lantern Pattern Paths
Picture a lantern puzzle where each step matters. In Lantern Pattern Paths, you are trying to work toward the right list by following one clear idea.
This problem feels a bit like a maze or map challenge. You need to think about how moves, paths, or links work together. Some places may still connect nicely, while others may be blocked or no longer fit the rule. The answer comes from following those connections carefully.
For example, if the input is base = "Pause by the willow.", markers = [], the answer is ["Pause by the willow."]. Example with input: base = "Pause by the willow.", markers = [] Another example is base = "Listen for distant bells.", markers = ["Golden Spine", "Silver Veil"], which gives ["Enter Golden Spine", "Enter Silver Veil", "Listen for distant bells.", "Mirror Silver Veil", "Listen for distant bells.", "Exit Silver Veil", "Mirror Golden Spine", "Enter Silver Veil", "Listen for distant bells.", "Mirror Silver Veil", "Listen for distant bells.", "Exit Silver Veil", "Exit Golden Spine"]. Example with input: base = "Listen for distant bells.", markers = ["Go
This is a friendly practice problem, but it still rewards careful reading. The key is keeping track of where you can move and which routes still follow the rule.
Example Input & Output
Example with input: base = "Pause by the willow.", markers = []
Example with input: base = "Listen for distant bells.", markers = ["Go
Example with input: base = "Pause by the willow.", markers = ["Azure B
Algorithm Flow

Best Answers
class Solution {
public int lantern_pattern_paths(int m, int n) {
return (int) nCr(m + n - 2, m - 1);
}
private long nCr(int n, int r) {
if (r > n) return 0;
if (r == 0 || r == n) return 1;
if (r > n / 2) r = n - r;
long res = 1;
for (int i = 1; i <= r; i++) {
res = res * (n - i + 1) / i;
}
return res;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
