Given a string str, the task is to find the XOR of ASCII values of characters in the string.
Input: str = “Geeks”
ASCII value of G = 71
ASCII value of e = 101
ASCII value of e = 101
ASCII value of k = 107
ASCII value of s = 115
XOR of ASCII values = 71 ^ 101 ^ 101 ^ 107 ^ 115 = 95
Input: str = “GfG”
Below is the implementation of the above approach:
Time Complexity: O(N), where N is the length of string.
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.
- Program to find the product of ASCII values of characters in a string
- Program to find the largest and smallest ASCII valued characters in a string
- Average of ASCII values of characters of a given string
- Count characters in a string whose ASCII values are prime
- Find the sum of the ascii values of characters which are present at prime positions
- Convert a string to hexadecimal ASCII values
- Check if a string contains only alphabets in Java using ASCII values
- Split a given string into substrings of length K with equal sum of ASCII values
- Count pairs of characters in a string whose ASCII value difference is K
- Find number of substrings of length k whose sum of ASCII value of characters is divisible by k
- Sum of the alphabetical values of the characters of a string
- Minimum length String with Sum of the alphabetical values of the characters equal to N
- Sums of ASCII values of each word in a sentence
- Map function and Dictionary in Python to sum ASCII values
- Sub-strings having exactly k characters that have ASCII value greater than p
- Minimize ASCII values sum after removing all occurrences of one character
- Count the number of words having sum of ASCII values less than and greater than k
- Count of alphabets whose ASCII values can be formed with the digits of N
- Print each word in a sentence with their corresponding average of ASCII values
- Find Kth largest string from the permutations of the string with two characters
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.