Find Missing Integer in Concatenated String
Given an integer n and a string s containing the concatenated decimal representations of all integers from 1 to n in random order with exactly one integer missing, return the missing integer.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early November, 2026
You are given an integer n and a string s containing the concatenated decimal representations of all integers from 1 to n, except that exactly one integer is missing. The integers in the string are arranged in a random order, and there are no separators between them. Each integer appears exactly once, except for the missing integer. Write a function solution(n, s) that returns the missing integer. ``` Input: n = 10 s = "1098253471" Output: 6 ```
Hello Interview Premium
Your account is free and you can post anonymously if you choose.