if length is even : then every element must occurs even times
if length is odd : then every element must occurs even times except one
element occurs odd...
With regards,
Praveen Raj
DCE-IT
735993
praveen0...@gmail.com
--
You received this message because you are subscribed to the Google
there is no need to calculate the length of the string as only one odd
occurrence is allowed,implying the length of the string will also be
odd in that case.
and if all occurrences are even,implicitly the length would be even.
On 9/13/11, sukran dhawan sukrandha...@gmail.com wrote:
find the
.write a program to find out if a word is a possible palindrome or
not...eg:tsetes becomes a palindrome aftr rearranging the letters so it is a
valid palindrome
--
Parag Khanna
B.tech Final Year
NIT,Kurukshetra
--
You received this message because you are subscribed to the Google Groups
find the length of string
count the occurenece of each character
if the length is odd den all characters shud be repeated even number of
times except one character which shud be repeated odd no o f times
if its even then all characters shud be repeated even number of times
On Tue, Sep 13, 2011
Q.) Take an array of 100 elements and fill it with the no 1 to 100 such that
one no. should skip and one no. should repeated. Find the no. which is
repeated and which is skipped.
--
Parag Khanna
B.tech Final Year
NIT,Kurukshetra
--
You received this message because you are subscribed to
1. Let x be the missing and y be the repeated element
3. Calculate the sum of all the elements and sum of squares of all the
elements of array.
S=Sum of all the elements of array
S1= Sum of squares of all the elements of array
Sum of first n natural numbers=a= ( n * (n+1) )/2
Sum of squares of
if you have to find only the repeated element, you can use the below
mentioned code.
for (int i = 1; i N; i++)
{
array[i] = array[i] ^ array[i-1] ^ i;
}
printf(Answer : %d\n, array[N-1]);
Thinking for the missing no.
On Sun, Sep 11, 2011 at 4:06 PM, ravi maggon maggonr...@gmail.com wrote:
no. are from 1 to 99 , by sum of n numbers formula we ve
sum(99)= (99*998)/2
but here we have an array a[100] with a repeated element.Sum of the numbers
in this array is
for(i=1;i100;i++)
{
sum1+=a[i];
}
repeated element = sum(99)-sum1;
--
You received this message because you are