My issue
I think i’ve written the ode correctly because it is showing the correct output. What test case have I missed ?
My code
#include <stdio.h>
int main() {
int arr[100] = {2, 4, 6, 8, 10}; // Initial array
int size = 5; // Current size of the array
int positionToDelete = 2; // Index of the element to delete
// Update the code to shift elements to fill the gap left by the deleted element
for( int i = positionToDelete -1 ; i< size-1; i++){
arr[i] = arr[ i + 1 ];
}
size--; // Update the size of the array
// Print the updated array
for (int i = 0; i < size ; i++) {
printf("%d ", arr[i]);
}
return 0;
}
Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-dsa-c/MUJDSAC05/problems/DSAAGP08