-There is series like - 7,7,7,8,7,7,8,8,8,7,7,7,7,7,8,8,8,8,7
-Find out occurence of 7 Output- 4
-Find out occurence of 8 Output- 3
-Maximum Occurence of 7 in one time- 5
Maximum Occurence of 8 in one time- 4
anita_2 0 Newbie Poster
Recommended Answers
Jump to Postnot to mention 7 occurs a lot more times than 4.
Jump to Postdon't use an array for the result, use a list.
if you use an array, that implies you know before you run your code the number of elements, which you don't.list result; while(iteration){ if ( currentElement isFirstElement OR currentElement != previousElement ){ result.add(currentElement); } }
All 6 Replies
Hiroshe 499 Posting Whiz in Training
stultuske 1,116 Posting Maven Featured Poster
anita_2 0 Newbie Poster
Slavi 94 Master Poster Featured Poster
anita_2 0 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.