Tap here to switch tabs
Problem
Submissions

Problem: Sum of Largest Prime Substrings

med
30 min
Try to solve the Sum of Largest Prime Substrings problem.

Statement

Given a string s consisting of digits, find all unique prime numbers that can be formed by converting any contiguous substring of s into an integer.

Return the sum of the 33 largest unique prime numbers obtained. If fewer than 33 unique prime numbers exist, return the sum of all available unique prime numbers. If no prime numbers can be formed, return 00.

Constraints:

  • 1≤1 \leq s.length ≤10\leq 10

  • s consists of only digits.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Largest Prime Substrings

med
30 min
Try to solve the Sum of Largest Prime Substrings problem.

Statement

Given a string s consisting of digits, find all unique prime numbers that can be formed by converting any contiguous substring of s into an integer.

Return the sum of the 33 largest unique prime numbers obtained. If fewer than 33 unique prime numbers exist, return the sum of all available unique prime numbers. If no prime numbers can be formed, return 00.

Constraints:

  • 1≤1 \leq s.length ≤10\leq 10

  • s consists of only digits.