Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void ex2(int[] a) {
- if (a != null && a.length > 0) {
- sovrascrive(a, 0, a.length);
- }
- }
- private static void sovrascrive(int[] a, int s, int d) {
- if (s < d) {
- if (s + 1 == d) {
- if (s % 2 == 0 && s + 1 < a.length) {
- a[s] = a[s + 1];
- }
- } else {
- sovrascrive(a, s, (s + d) / 2); sovrascrive(a, (s + d) / 2, d);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement