3918. Sum of Primes Between Number and Its Reverse
You are given an integer n. Let r be the integer formed by reversing the digits of n. Return the sum of all prime numbers between min(n, r) and max(n, r), inclusive. Example 1: Input: n = 13 Output: 132 Explanation: - The reverse of 13 is 31. Thus, the range is [13, 31]. - The prime numbers in this range are 13, 17, 19, 23, 29, and 31. - The sum of these prime numbers is 13 + 17 + 19 +
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start