Company: Flipkart

Difficulty: medium

Problem Statement

Mr. Thomas is a well-known mathematician. At an education fair he noticed a lot of bright students, so he set them the following problem. A number num is defined as num = P 1 + P 2 + ... + P N where each P i is an integer written in the compressed form XYZ : Z is the last digit of P i . It states how many digits form the power . Y is the block of the Z digits standing immediately before that last digit. This block is the power (exponent). X is everything left over at the front of P i . It is the base . The operand therefore contributes X Y to the sum, and the digit Z itself is discarded. Worked example Take num = 3011 + 1122 . 3011 : the last digit is Z = 1 , so the power uses 1 digit — that digit is Y = 1 . What remains in front is X = 30 . This term is 30 1 = 30 . 1122 : the last digit is Z = 2 , so the power uses 2 digits — those digits are Y = 12 . What remains in front is X = 1 . This term is 1 12 = 1 . Hence num = 30 + 1 = 31 . Input Format The first line contains the

More Flipkart OA questionsInterview experiences