Advertisement
Guest User

Untitled

a guest
Oct 13th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. int equal_and_unequal_count(int *unequal_count) {
  2. int equal_count = 0;
  3. int unequal_count_ = 0;
  4. int start = 0;
  5. for (int i = 1; i <= size; i++)
  6. if (i == size || data[i] != data[i - 1]) {
  7. if (i - 1 == start)
  8. unequal_count_++;
  9. else
  10. equal_count += (i - start);
  11. start = i;
  12. }
  13. *unequal_count = unequal_count_;
  14. return equal_count;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement