class Solution {
public:inttitleToNumber(string s){int num =0;for(int i =0; i < s.size(); i ++){
num = num *26+(s[i]-'A'+1);}return num;}};
class Solution {
public:inttrailingZeroes(int n){return n <5?0: n /5+trailingZeroes(n/5);}};
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class BSTIterator {
public:
stack<TreeNode*> stk;BSTIterator(TreeNode* root){while(root){
stk.push(root);
root = root->left;}}/** @return the next smallest number */intnext(){auto t = stk.top();
stk.pop();for(auto p = t->right; p; p = p->left) stk.push(p);return t->val;}/** @return whether we have a next smallest number */
bool hasNext(){return!stk.empty();}};/**
* Your BSTIterator object will be instantiated and called as such:
* BSTIterator* obj = new BSTIterator(root);
* int param_1 = obj->next();
* bool param_2 = obj->hasNext();
*/
class Solution {
public:intcalculateMinimumHP(vector<vector<int>>& dungeon){int n = dungeon.size();int m = dungeon[0].size();
vector<vector<int>>f(n, vector<int>(m,0));for(int i = n -1;~i; i --)for(int j = m -1;~j; j --)if(i == n -1&& j == m -1)
f[i][j]=max(1- dungeon[i][j],1);elseif(i == n -1)
f[i][j]=max(1, f[i][j +1]- dungeon[i][j]);elseif(j == m -1)
f[i][j]=max(1, f[i +1][j]- dungeon[i][j]);else
f[i][j]=min(max(1, f[i +1][j]- dungeon[i][j]),max(1, f[i][j +1]- dungeon[i][j]));return f[0][0];}};
# Write your MySQL query statement below
select FirstName, LastName, City, State
from Person left join Address
on Person.PersonId = Address.PersonId;
class Solution {
public:static bool cmp(int x,int y){
string sx =to_string(x), sy =to_string(y);return sx + sy > sy + sx;}
string largestNumber(vector<int>& nums){sort(nums.begin(), nums.end(), cmp);
string res ="";for(auto c : nums)
res +=to_string(c);for(int i =0; i < res.size(); i ++)//去除前面多余的0if(i == res.size()-1|| res[i]!='0')return res.substr(i, res.size()- i);return res;}};