-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheetsheet_methods.cpp
More file actions
46 lines (29 loc) · 1.31 KB
/
Copy pathcheetsheet_methods.cpp
File metadata and controls
46 lines (29 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
#include<string>
using namespace std;
// Strings :
// .rfind() - starting your search from the very end of the long string and moving backward, looking for the first time you see your small string
// It's a compact way to perform a "starts with" check.
//=============================================================================================================================================
// string sentence = "hello world hello";
// string word = "hello";
// int pos = sentence.rfind(word); // Looks for the last "hello"
// pos will be 12 (the 'h' of the second "hello")
string c = "abc";
// cout << c.back();
// isdigit()
// stoi()
// int num = '1'-'0'; // string to int conversion
//=============================================================================================================================================
// Sets
// .find()
// .end()
// .begin()
// .count()
//=============================================================================================================================================
// subset INCLUDE/EXCLUDE PRINCIPLE (not necessarily continuos)
// BITWISE AND
int num = [1, 2, 3, 4, 5]
// AND of full array ≤ min(array elements)
// OR of full array ≥ max(array elements)
// AND acts like a filter (removes bits); OR acts like a union (adds bits)