Given 2 strings that have all letters in common except one f

Given 2 strings that have all letters in common except one, find the letter that is the odd one out. Example Output: Enter 2 words: chase arches The extra letter is r

Solution

class OddOccurance

{

    int getOddOccurrence(int ar[], int ar_size)

    {

        int i;

        int res = 0;

        for (i = 0; i < ar_size; i++)

        {

            res = res ^ ar[i];

        }

        return res;

    }

 Given 2 strings that have all letters in common except one, find the letter that is the odd one out. Example Output: Enter 2 words: chase arches The extra lett

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site