1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Same digits (Python) [closed]

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    We call special number is number that have the same digits like 1, 222, 5555, 88, 777777

    Given a list a, given a list call "a" with "n" numbers, find pairs of number in the list which the sum of it is a special number

    Example:

    Input

    5

    1 2 3 4 5

    Output:

    10

    Explain:

    a0 + a1 = 1 + 2 = 3 (special number)

    a0 + a2 = 1 + 3 = 4 (special number)

    a0 + a3 = 1 + 4 = 5 (special number)

    a0 + a4 = 1 + 5 = 6 (special number)

    a1 + a2 = 2 + 3 = 5 (special number)

    a1 + a3 = 2 + 4 = 6 (special number)

    a1 + a4 = 2 + 5 = 7 (special number)

    a2 + a3 = 3 + 4 = 7 (special number)
    a2 + a4 = 3 + 5 = 8 (special number)

    a3 + a4 = 4 + 5 = 9 (special number)

    n < 2*10^5

    1 <= ai <= 10^6

    Solve under 4s

    Continue reading...

Compartilhe esta Página