Great indian programming league March 2013 contest.
Nagesh1 last edited by
This is one group on techgig.com
You can participate and win prizes like t-shirts and stuff. This is the contest they have in March 2013.
Problem Statement Question here is that you are given range of number (A to and you have to tell the sum of slope of all the number between A and B. Now we define the term slope of a number N. Slope of a number N is the number of digits (excluding the first and the last digit) which is either maxima or minima in that number. Consider a number N. A digit in number N is called minima if it is smaller than both of its neighbour and a digit is called maxima if it is larger than both of its neighbour. In case of wrong ranges or unexpected ranges, please return output as -1
Input/Output Specs Input Specification: Input 1 specifies the starting range of numbers. It will be of integer type Input 2 specifies the ending range of numbers. It will be of integer type Output Specification: sum of slope value of all the number in the given range . Output will be of integer type In case of wrong ranges or unexpected ranges, please return output as -1
Example 1 : Consider the range 1-100 in this range all the numbers are either one digit or 2 digit so the slope value of all the number is zero and hence the sum is zero. Similarly, consider the range 100-150 the sum of slope of all the number in this range is 19 Example 2 : Consider the number 54698 in range 54698-54800. In this number 4 is a minima because it is smaller than it both neighbor i.e. 5 and 6. similarly digit 9 is a maxima because it is grater than both of its neighbor i.e. 6 and 8. Slope of 54698 is 2 because it has 4 as minima and 9 as maxima and there is no other minima or maxima. Similarly we check next numbers in the range 54698-54800 and sum of slope of all the numbers will be the output.
Some folks have already solved this and I wish them all luck. As for me, I am trying to find out meaning of slope. Then perhaps I can win the t-shirt.