Sort by

recency

|

2184 Discussions

|

  • + 0 comments

    Here is my c++ solution, you can watch video explanation here : https://youtu.be/Z_CYzW_sQAE

    Solution 1

    vector<int> reverseArray(vector<int> a) {
      reverse(a.begin(), a.end());
      return a;
    }
    

    Solution 2

    vector<int> reverseArray(vector<int> a) {
       vector<int> result; 
        for(int i = a.size() - 1; i >= 0; i--){
            result.push_back(a[i]);
        }
        return result;
    }
    
  • + 0 comments

    it_ogy?jigpp74yai4$20000?

  • + 0 comments

    Arrays are fundamental in data structures, allowing efficient storage and manipulation of elements. Mastering array operations like reversals, sorting, and searching is crucial for problem-solving in coding.

    By the way, if you’re looking to send flowers to Pakistan, check out some great online flower delivery services!

  • + 0 comments

    Here is my solution in java

    int length=a.size();
        List<Integer> b=new ArrayList<>();
        int i=0;
        int j=length-1;
        while(j>=0){
            b.add(i, a.get(j));
            i++;
            j--;
        }
        
        return b;
    
  • + 0 comments
    //java 15 code
    
        public static List<Integer> reverseArray(List<Integer> a) {
            for(int i=0;i<a.size()/2;i++){
        int j=a.size()-1-i;
       Collections.swap(a, i, j);
    
    }
    return a;
    
    }