Given a integer n, we need to find how many digits remove from the number to make it a perfect square.
Input : 8314
Output: 81 2
Explanation: If we remove 3 and 4 number becomes 81 which is a perfect square.
Input : 57
Output : -1
8, 3, 83, 1, 81, 31, 831, 4, 84, 34, 834, 14, 814, 314, 8314.
After forming all possible subsequences, we check which one is the perfect square. And we return a perfect square number which has the minimum length.
In above example, three perfect squares are 1 4 and 81, so answer would be 81 because 81 has the max length 2.
81 2 -1
- Find minimum number to be divided to make a number a perfect square
- Smallest N digit number whose sum of square of digits is a Perfect Square
- Least number to be added to or subtracted from N to make it a Perfect Square
- Minimum divisor of a number to make the number perfect cube
- Find smallest perfect square number A such that N + A is also a perfect square number
- Minimum number to be added to all digits of X to make X > Y
- Check if a number is perfect square without finding square root
- Count of elements to be multiplied with integers to make each pair of Array a perfect square
- Perfect Square factors of a Number
- Largest number that is not a perfect square
- Check if given number is perfect square
- Number of times the largest perfect square number can be subtracted from N
- Previous perfect square and cube number smaller than number N
- Smallest number with given sum of digits and sum of square of digits
- Largest perfect square number in an Array
- Find the Next perfect square greater than a given number
- Largest factor of a given number which is a perfect square
- Check whether the number can be made perfect square after adding K
- Check if a given number is a Perfect square using Binary Search
- Largest Divisor of a Number not divisible by a perfect square
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : manishshaw1