1// my linkedin : https://www.linkedin.com/in/vaalarivan-prasanna-3a07bb203/
2vector<int> vec = {1, 2, 1, 1};
3cout << count(vec.begin(), vec.end(), 1);
4// 3 is printed as 1 occurs thrice in the vector
11 #include <iostream>
22 #include <array>
33 #include <algorithm>
44
55 using namespace std;
66
77 int main(){
88 array<int, 5> nums = {1, 2, 3, 100, 2};
99 //counting number of twos
1010 int numOccurrences = count(nums.begin(), nums.end(), 2);
1111 cout << 2 << " appeared " << numOccurrences << " times" << endl;
1212 return 0;
1313 }
1414
1515 /*
1616 2 appeared 2 times
1717 */