We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #8: Largest product in a series

Project Euler #8: Largest product in a series

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 8 from projecteuler.net

Find the greatest product of consecutive digits in the digit number.

Input Format

First line contains that denotes the number of test cases.
First line of each test case will contain two integers & .
Second line of each test case will contain a digit integer.

Constraints

Output Format

Print the required answer for each test case.

Sample Input 0

2
10 5
3675356291
10 5
2709360626

Sample Output 0

3150
0

Explanation 0

  • For and selecting consequetive digits, we have , , , , and . Where gives maximum product as
  • For , lies in all selection of consequetive digits hence maximum product remains

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

20886

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy