Find how many ordered pairs of integers share only one digit
APL (Dyalog Extended or 18.0), 24 22 bytesSBCS



Full program.

≢⍸∘.(&lt;∧1=∘≢∘∪∩⍥⍕)⍨1↓⍳⎕


Try it online!

⎕ prompt for N from the console

⍳ first N integers

1↓ drop the first one (0)

 ⍨ apply the following function using those integers as both left and right argument:

  ∘.(…) apply the following function between all combinations of left and right elements:

   ⍥⍕ stringify (make into character list) both arguments, then:

    ∩ find the intersection between the character lists

   ∪ find the Unique elements of that

   ∘ then:

    ≢ count that

   ∘ then:

    1= check if that is equal to 1

   ∧ and

   &lt; the left argument is less than the right argument

⍸ find the ɩndices of the trues

≢ count them