Given two numbers a and b, the task is to check whether the concatenation of a and b is a perfect cube or not.
Input: a = 6, b = 4
Concatenating 6 and 4 = 64. Since 64 (= 4 x 4 x 4) is a perfect cube, the output is Yes.
Input: a = 100, b = 1
Concatenating 100 and 1 = 1001. Since 1001 is not a perfect cube, the output is No.
Approach: Since appending strings are comparatively easier than appending numbers, the simplest way to solve this problem is to convert the given integers into strings. Once the concatenated number has been obtained, it can be easily checked if it is a perfect cube or not.
Below is the implementation of the above approach.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Check whether the number formed by concatenating two numbers is a perfect square or not
- Count numbers upto N which are both perfect square and perfect cube
- Print N numbers such that their sum is a Perfect Cube
- Check whether N can be a Perfect Cube after adding or subtracting K
- Print N numbers such that their product is a Perfect Cube
- Number of cycles formed by joining vertices of n sided polygon at the center
- Number of triangles formed by joining vertices of n-sided polygon with one side common
- Perfect cube greater than a given number
- Check if the number formed by the last digits of N numbers is divisible by 10 or not
- Largest number in an array that is not a perfect cube
- Previous perfect square and cube number smaller than number N
- Minimum divisor of a number to make the number perfect cube
- Number of times the largest Perfect Cube can be subtracted from N
- Least number to be added to or subtracted from N to make it a Perfect Cube
- Find the Largest Cube formed by Deleting minimum Digits from a number
- Number of triangles formed by joining vertices of n-sided polygon with two common sides and no common sides
- Perfect Cube
- Perfect Cube String
- Check if product of array containing prime numbers is a perfect square
- Smallest perfect cube in an array
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.