C++ notes for PS

This is my notes for problem solving in c++, that I’ve learned while coding in C++ and found them helpful.

convert string to lowercase.

trasform(s.begin(),s.end(),s.begin(),::tolower);

check this character is alpha.

isalpha(char);

check the character is in upper case

isupper(char);

Import all libs

<bits/stdc++.h>

copy contents of deque of chars into string

std::string ss(dqu.begin(),dqu.end());

Modulo of a negative number [Example]

(?n)%k == (k?(n%k))%k

Find substring

std::size_t zero7 = s.find("0000000"); if(zero7!=std::string::npos) found=true;