Answer: Walmart, 29th October, Recently asked Online Assessments and On-Campus Questions

Answer · Posted Nov 2022

Solution to problem 1 Since the range of the numbers are of order 10⁹⁹, checking for each number would give TLE. It can be observed that p is small. This problem can be solved by digit dp. Let the answer for the numbers between 0 to x be f(x), so we will need to calculate f(R)-f(L-1). As L is given in the form of string, to get L-1, we will iterate backward till we don’t find a non zero digit, ...

The full answer & interview discussion are available to premium members.

Log in Create a free account