TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chaitanya
NA
58
57k
How to find out whether the list contains missing elements or not
Sep 9 2011 11:04 AM
I am having a requirement like to find out the missing numbers in the list available. I implemented a code but i am unable to get for some of the sequences.
Suppose if i have my list elements as 1,3 i would like to return this as false as 2 is missing.
If i have 1,2,3 i would like to return true as it is in sequence.
Like that i have random numbers in my list so can any one give me the logic for this
I tried this but for some conditions it is not working
int iMax = 0;
int iMin = 0;
iMin = (int)lstSequence[0];
for (int iLoop = 0; iLoop < lstSequence.Count; iLoop++)
{
iMax = (int)lstSequence[iLoop];
}
for (int icompare = iMin; icompare <= iMax; icompare++)
{
if (icompare == iMin || icompare == iMax)
{
}
else
{
if (lstSequence.Contains(icompare))
{
seq_flag = true;
}
else
{
seq_flag = false;
}
}
}
Reply
Answers (
2
)
Realize Virtual cd rom
How to read clicked buttons inside a single groupbox?