Skip to content

Instantly share code, notes, and snippets.

/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
/**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/
class Solution {
class Solution {
public:
void sortColors(vector<int>& nums) {
int zeroI = 0, secndI = nums.size() - 1;
for(int i = 0; i < nums.size(); i++) {
while (nums[i] == 2 && i < secndI) swap(nums[i], nums[secndI--]);
while (nums[i] == 0 && i > zeroI) swap(nums[i], nums[zeroI++]);
}
}
};
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
typedef map<int, map<long int, vector<Allele> > >::iterator it_type;
for (it_type it = inputVariantAlleles.begin(); it != inputVariantAlleles.end(); it++) {
cerr << "CK variant input 1 level key:" << it->first << endl;
typedef map<long int, vector<Allele> >::iterator it_type2;
for (it_type2 it2 = it->second.begin(); it2 != it->second.end(); it2++) {
cerr << "CK variant input 2 level key:" << it2->first << endl;
cerr << "CK variant input 2 level value:" << it2->second << endl;
vector<Allele>& inputalleles = it2->second;
for (vector<Allele>::iterator a = inputalleles.begin(); a != inputalleles.end(); ++a) {
Allele& allele = *a;
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {