Sastry Numbers

Given an integer N, the task is to check N is a Sastry number.
A number N is a Sastry Number if N concatenated with N + 1 gives a perfect square.
Examples:
Input: N = 183
Output: Yes
Explanation:
183 + 184 = 183184 = 4282
Input: N = 28
Output: No
Approach: The idea is to convert the number to string and concatenate N and (N + 1) and then again convert it to an integer. Now we just have to check if the final number is a perfect square. If yes then the given number is a Sastry number.
Below is the implementation of the above approach:
Output
Yes
References: OEIS
Feeling lost in the world of random DSA topics, wasting time without progress? It’s time for a change! Join our DSA course, where we’ll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 zambiatek!
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 zambiatek!



