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
- Check if a number is a perfect square having all its digits as a perfect square
- Find smallest perfect square number A such that N + A is also a perfect square number
- Smallest N digit number whose sum of square of digits is a Perfect Square
- Find minimum number to be divided to make a number a perfect square
- Minimum digits to be removed to make either all digits or alternating digits same
- Count numbers upto N which are both perfect square and perfect cube
- Check if a number is perfect square without finding square root
- Least number to be added to or subtracted from N to make it a Perfect Square
- Count of elements to be multiplied with integers to make each pair of Array a perfect square
- Minimum divisor of a number to make the number perfect cube
- Smallest number with given sum of digits and sum of square of digits
- Sum of the digits of square of the given number which has only 1's as its digits
- Number of times the largest perfect square number can be subtracted from N
- Previous perfect square and cube number smaller than number N
- Check if given number is perfect square
- Find the Next perfect square greater than a given number
- Largest factor of a given number which is a perfect square
- Largest perfect square number in an Array
- Check whether the number can be made perfect square after adding 1
- Largest N digit Octal number which is 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