This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Definition for singly-linked list. | |
| * struct ListNode { | |
| * int val; | |
| * ListNode *next; | |
| * ListNode(int x) : val(x), next(NULL) {} | |
| * }; | |
| */ | |
| class Solution { | |
| public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } | |
| } |
NewerOlder