6 kyu

Highest Perfect Square with Same Digits

194 of 246raulbc777

Description:

There are some perfect squares with a particular property. For example the number n = 256 is a perfect square, its square root is 16. If we change the position of the digits of n, we may obtain another perfect square 625 (square root = 25). With these three digits 2,5 and 6 we can get two perfect squares: [256,625]

The number 1354896 may generate another 4 perfect squares, having with the number itself, a total of five perfect squares: [1354896, 3594816, 3481956, 5391684, 6395841], being the last one in the list, 6395841, the highest value of the set.

Your task is to find the first perfect square above the given lower_limit, that can generate the given k number of perfect squares, and it doesn't contain the digit 0. Then return the maximum perfect square that can be obtained from its digits.

Example with the cases seen above:

lower_limit = 200
k = 2 (amount of perfect squares)
result = 625

lower_limit = 3550000
k = 5 (amount of perfect squares)
result  = 6395841

Features of the random tests:

100 <= lower_limit <= 1e6
2 <= k <= 5
number of tests = 45

Have a good time!

Fundamentals
Data Structures
Algorithms
Mathematics
Performance
Permutations

Stats:

CreatedJun 22, 2018
PublishedJun 22, 2018
Warriors Trained1409
Total Skips74
Total Code Submissions1694
Total Times Completed246
Python Completions194
Rust Completions18
D Completions3
Go Completions10
JavaScript Completions39
Lua Completions5
Total Stars52
% of votes with a positive feedback rating90% of 68
Total "Very Satisfied" Votes57
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes3
Total Rank Assessments3
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • raulbc777 Avatar
  • Blind4Basics Avatar
  • akar-0 Avatar
  • lincot Avatar
  • metatable Avatar
  • saudiGuy Avatar
Ad