Skip to content

Instantly share code, notes, and snippets.

View shaobos's full-sized avatar

Shaobo Sun shaobos

  • Sunnyvale, California, US
View GitHub Profile
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
int chec_balance (TreeNode* node) {
if (node == NULL) {
return 0;
}
int l = check_balance(node->left);
int r = ...
if (l == -1 || r== -1) {
return -1;
}
class Solution {
public:
int reverse(int x) {
int quotient = 0;
int residue = 0;
int reversed_integer = 0;
while (x!=0) {
residue = x%10;
x = x/10;
reversed_integer = reversed_integer * 10 + residue;
int main() {
vector<int> b;
b.push_back(-6);
b.push_back(-4);
int a = 3;
for(vector<int>::iterator iter = b.begin(); iter!= b.end(); iter++){
if (a < iter) {
cout<<"noooo"<<endl;
}
}