Pages

Saturday, April 26, 2025

2D Array Vectors in C++ (2)

 #include <iostream>

#include <vector>

using namespace std;


int main()

{

    vector<int> vec;

    

    

    for(int i=0; i<5; i++) {

        vec.push_back(i);

    }

    

    cout << vec.size() << endl;

    cout << vec.capacity() << endl;

    return 0;

}

No comments:

Post a Comment

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...