This is a verified interview question from Linkedin. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Parity Balanced Numbers in Range - Linkedin Online Assessment IIT Kanpur" covers key patterns like Other.
"You are given two non-negative integers L and R represented as decimal strings. Their lengths can be up to 10^5, so they may not fit in standard integer types. A positive integer is called parity balanced if the parity (even/odd) of the sum of digits at odd positions is the same as the parity of the sum of digits at even positions. Positions are 1-indexed from the leftmost digit. Your task is to determine how many parity balanced numbers lie in the inclusive range [L, R]. Since the answer can be large, print it modulo 10^9 + 7. ### Input Format The first line contains the string L. The second line contains the string R. ### Output Format Print a single integer — the number of parity balanced integers in [L, R] modulo 10^9 + 7. Sample Input 10 20 Sample Output 6 Explanation The valid numbers are: 11 13 15 17 19 20"
Join thousands of developers practicing for Linkedin.