Given a String str, the task is to check the sum of ASCII values of all characters in this string is a perfect cube or not.
Input: str = "ll" Output: Yes ASCII value of l = 108 Therefore, sum of ASCII values = 108 + 108 = 216 which is a perfect cube 6 (6 * 6 * 6 = 216) Input: str = "a" Output: No ASCII value of a = 97 Therefore, sum of ASCII values = 97 which is not a perfect cube
- For each character in the String, find out its ASCII value
- Calculate sum of ASCII values of all characters
- Check whether this sum is a perfect cube or not.
- If the sum is a perfect cube, then print “Yes” otherwise “No”
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.
- Count numbers upto N which are both perfect square and perfect cube
- Perfect Cube
- Smallest perfect cube in an array
- Perfect cube greater than a given number
- Print N numbers such that their sum is a Perfect Cube
- Print N numbers such that their product is a Perfect Cube
- Largest perfect cube number in an Array
- Largest number in an array that is not a perfect cube
- Count of pairs in an Array whose sum is a Perfect Cube
- Check whether N can be a Perfect Cube after adding or subtracting K
- Count all triplets whose sum is equal to a perfect cube
- Construct an Array such that cube sum of all element is a perfect square
- Number of times the largest Perfect Cube can be subtracted from N
- Smallest perfect Cube divisible by all elements of an array
- Least number to be added to or subtracted from N to make it a Perfect Cube
- Check if number formed by joining two Numbers is Perfect Cube
- Construct an Array of size N whose sum of cube of all elements is a perfect square
- Minimum divisor of a number to make the number perfect cube
- Previous perfect square and cube number smaller than number N
- Perfect reversible string
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.