Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a prog to accept a given string in any order and flash
error if any of the character is different.

For example : If abc is the input then abc, bca, cba, cab
bac are acceptable, but aac or bcd are unacceptable.

Answer Posted / yegullelew

My answer is O(n) - but it is done in C# sorry for C guys
public bool isAccepted(string original, string
toCompare)
{
if (original.Length != toCompare.Length)
return false;
bool[] flags = new bool[128];
for (int i = 0; i < toCompare.Length; i++)
flags[toCompare[i]] = true;
for (int i = 0; i < original.Length; i++)
if (!flags[original[i]])
return false;
return true;
}

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

could you please send the program code for multiplying sparse matrix in c????

3587


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

994


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

3004


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

3241


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

2476


why nlogn is the lower limit of any sort algorithm?

2852


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2912


write a simple calculator c program to perform addition, subtraction, mul and div.

3727


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2552


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

6992


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

4532


What is data _null_? ,Explain with code when u need to use it in data step programming ?

3352


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3648


Cluster head selection in Wireless Sensor Network using C programming language.

3748


What is full form of PEPSI

2423