Relative Content

Tag Archive for carrays

what’s wrong with reversing array?

I will be given an array. It can be sorted or unsorted. If it is unsorted, my task it to check if I can swap two integers that make the array sorted. I read the array then I checked if the array is sorted or not, if it’s not, I made two integers. The first check the number which made the problem from the first and the second integer checks the number which made the problem from the end of the array, then I reversed the sub array from the index of the first integer to the index of the second Integer. but there is something wrong in my code. denote the size of the array(n) which (1<=n<=10^5) , and the time limit for this problem is 1 second. Which does not allow me use inner loops. And the array is 1-based.

what’s wrong with reversing array?

I will be given an array. It can be sorted or unsorted. If it is unsorted, my task it to check if I can swap two integers that make the array sorted. I read the array then I checked if the array is sorted or not, if it’s not, I made two integers. The first check the number which made the problem from the first and the second integer checks the number which made the problem from the end of the array, then I reversed the sub array from the index of the first integer to the index of the second Integer. but there is something wrong in my code. denote the size of the array(n) which (1<=n<=10^5) , and the time limit for this problem is 1 second. Which does not allow me use inner loops. And the array is 1-based.

How to find size or length of char array [duplicate]

This question already has answers here: finding size of char array in C++ (3 answers) How do I determine the size of my array in C? (22 answers) Closed yesterday. I have a char array declared as char input[], and I want to know how to find its size or length. What is the correct […]