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 #104: Pandigital Fibonacci ends

Project Euler #104: Pandigital Fibonacci ends

Problem
Submissions
Leaderboard
Discussions

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

The Generalized Fibonacci sequence is defined by the recurrence relation:

It turns out that , which contains digits, is the first Fibonacci number for which the last nine digits are pandigital (contain all the digits to , but not necessarily in order). And , which contains digits, is the first Fibonacci number for which the first nine digits are pandigital.

Given that is the first Generalized Fibonacci number for which the first digits AND the last digits are pandigital, find .

NOTE For this problem if you don't find a solution with in , print no solution.

Input Format

First line of input contains , second line contains and the third line contains .

Constraints


Output Format

Print the value where is the required generalized fibonacci term.

Sample Input

1
1
2

Sample Output

8

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

896

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy