- 博客(40)
- 资源 (27)
- 收藏
- 关注
原创 [codility]Falling-discs
// you can also use includes, for example:// #include #includeint solution(vector &A, vector &B) { // write your code in C++98 //...first transform the dry well to a sorted one in decreasin
2013-11-28 20:57:12 1278
原创 [codility]Array-inversion-count
// you can also use includes, for example:// #include long long getInversionCount(vector& workArr, int start, int end){ if(start >= end) return 0; int mid = start+(end-start)/2; long lo
2013-11-28 20:56:34 1945
原创 [codility]Prefix-set
// you can also use includes, for example:// #include int solution(const vector &A) { // write your code in C++98 //...keep record of all the elements that exist in the array vector exis
2013-11-28 20:55:51 1883
原创 [codility]Tree-height
// you can also use includes, for example:// #include int getDepth(tree* T){ if(!T) return 0; return max(getDepth(T->l), getDepth(T->r))+1;}int solution(tree * T) { // write your code
2013-11-28 20:55:17 1750
原创 [codility]Max-profit
// you can also use includes, for example:// #include #include int solution(const vector &A) { // write your code in C++98 //...find out the minimum price you haved scaned, then we can
2013-11-28 20:54:41 1458
原创 [codility]Equi
// you can also use includes, for example:// #include int solution(const vector &A) { // write your code in C++98 //...calculate the sum of the array first long long sum = 0; for(int
2013-11-28 20:54:09 989
原创 [codility]Binary-gap
// you can also use includes, for example:// #include int solution(int N) { // write your code in C++98 //...traverse the binary representation from low digit to high, //keep record of m
2013-11-28 20:53:38 2660
原创 [codility]Abs-distinct
// you can also use includes, for example:// #include int solution(const vector &A) { // write your code in C++98 //...traverse the array from both direction, and move according to the
2013-11-28 20:52:55 1843
原创 [codility]Equi-leader
// you can also use includes, for example:// #include int getLeaderIndex(const vector &A){ //...record the count of current winner number, then int winnerNumber; int winnerNumberLeftCou
2013-11-27 13:34:45 1425
原创 [codility]Dominator
// you can also use includes, for example:// #include int solution(const vector &A) { // write your code in C++98 //...record the count of current winner number, then int winnerNumber;
2013-11-27 13:34:14 1171
原创 [codility]Stone-wall
// you can also use includes, for example:// #include #include int solution(const vector &H) { // write your code in C++98 //...using queue + greedy int blockCnt = 0; stack wallStac
2013-11-27 13:33:29 1763
原创 [codility]Fish
// you can also use includes, for example:// #include #include int solution(vector &A, vector &B) { // write your code in C++98 //...keep record of downstream fishs in stack stack down
2013-11-27 13:32:56 1318
原创 [codility]Brackets
// you can also use includes, for example:// #include #include int solution(const string &S) { // write your code in C++98 //...using stack to verify if it is properly nested stack char
2013-11-27 13:32:17 2143 4
原创 [codility]Number-of-disc-intersections
// you can also use includes, for example:#include struct IntervalSeg{ long long left, right; IntervalSeg(long long _left = 0, long long _right = 0):left(_left),right(_right){} bool ope
2013-11-27 13:31:33 1542
原创 [codility]Max-product-of-three
// you can also use includes, for example:#include #include int solution(vector &A) { // write your code in C++98 //...sort A first sort(A.begin(), A.end()); //...enumerate Q, and t
2013-11-27 13:30:50 1422
原创 [codility]Triangle
// you can also use includes, for example:// #include #includeint solution(const vector &A) { // write your code in C++98 if(A.size() < 3) return 0; vector sortedEdge = A; //...sort
2013-11-27 13:30:03 1195
原创 [codility]Genomic-range-query
// you can also use includes, for example:// #include vector solution(string &S, vector &P, vector &Q) { // write your code in C++98 vector result(P.size()); //...keep record of the pref
2013-11-27 13:29:19 1395
原创 [codility]Passing-cars
// you can also use includes, for example:// #include int solution(vector &A) { // write your code in C++98 //...limit result int MAX_LIMIT = 1000000000; //...keep record of prefix z
2013-11-27 13:28:43 1181
原创 [codility]Max-Counters
// you can also use includes, for example:// #include vector solution(int N, vector &A) { // write your code in C++98 //...keep record of minValue across the whole array to reach O(n+m) time
2013-11-27 13:27:55 1478
原创 [codility]Frog-River-One
// you can also use includes, for example:// #include #includeint solution(int X, vector &A) { // write your code in C++98 //...out of range case if(X > A.size()) return -1; //...ke
2013-11-27 13:27:13 1392 2
原创 [codility]Perm-Check
// you can also use includes, for example:// #include int solution(vector &A) { // write your code in C++98 //...modify the input array, let all the elements in the right place for(int i
2013-11-27 13:26:39 1294
原创 [codility]Tape-Equilibrium
// you can also use includes, for example:// #include #includeint solution(vector &A) { // write your code in C++98 if(A.size() < 2) return 0; //...precalculate the sum array vector
2013-11-27 13:26:00 1562
原创 [codility]Perm-Missing-Elem
// you can also use includes, for example:// #include int solution(vector &A) { // write your code in C++98 //enumate each element in the array, if it's not in the right place, then try to f
2013-11-27 13:25:27 1215
原创 [codility]Frog-Jmp
// you can also use includes, for example:// #include int solution(int X, int Y, int D) { // write your code in C++98 int totalDis = Y-X; int remainder = totalDis%D; int quotient = t
2013-11-27 13:24:37 1061
原创 [LeetCode]Clone Graph
/** * Definition for undirected graph. * struct UndirectedGraphNode { * int label; * vector neighbors; * UndirectedGraphNode(int x) : label(x) {}; * }; */class Solution {public:
2013-11-20 14:11:15 1561
原创 [LeetCode]Gas Station
class Solution {public: int canCompleteCircuit(vector &gas, vector &cost) { // Note: The Solution object is instantiated only once and is reused by each test case. int n = gas.siz
2013-11-20 14:10:42 1059
原创 [LeetCode]Candy
class Solution {public: int candy(vector &ratings) { // Note: The Solution object is instantiated only once and is reused by each test case. vector candyNum(ratings.size(), 1);
2013-11-20 14:10:09 1250
原创 [LeetCode]Single Number
class Solution {//using xor bit manipulationpublic: int singleNumber(int A[], int n) { // Note: The Solution object is instantiated only once and is reused by each test case. int
2013-11-20 14:09:27 905
原创 [LeetCode]Single Number II
class Solution {public: int singleNumber(int A[], int n) { // Note: The Solution object is instantiated only once and is reused by each test case. vector bitNum(32, 0); fo
2013-11-20 14:08:44 1156
原创 [LeetCode]Copy List with Random Pointer
/** * Definition for singly-linked list with a random pointer. * struct RandomListNode { * int label; * RandomListNode *next, *random; * RandomListNode(int x) : label(x), next(NULL),
2013-11-20 14:08:01 1180
原创 [LeetCode]Word Break
class Solution {public: bool wordBreak(string s, unordered_set &dict) { // Note: The Solution object is instantiated only once and is reused by each test case. int n = s.size();
2013-11-20 14:07:09 1231
原创 [LeetCode]Word Break II
class Solution {//initialization problem will cause WA, because wordBreak whould be called several times for several cases in one instance//the whole memozation will also record the string which has
2013-11-20 14:06:27 1725
原创 [LeetCode]Linked List Cycle
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: bool hasCycl
2013-11-20 14:05:43 1012
原创 [LeetCode]Linked List Cycle II
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *de
2013-11-20 14:04:56 1161
原创 [LeetCode]Reorder List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: void reorder
2013-11-20 14:04:08 1952
原创 [LeetCode]Binary Tree Preorder Traversal
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti
2013-11-20 14:03:17 1303
原创 [LeetCode]Binary Tree Postorder Traversal
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti
2013-11-20 14:02:35 1284
原创 [LeetCode]LRU Cache
class LRUCache{ struct ListNode//for LRU { int value; int key; ListNode* prev; ListNode* next; ListNode(int _key, int _value):key(_key), value(_value),
2013-11-20 14:01:55 1646
原创 [LeetCode]Insertion Sort List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *in
2013-11-20 14:01:03 1575
原创 [LeetCode]Sort List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *so
2013-11-20 13:59:53 2070 2
color transfer 颜色转化
2011-12-06
c语言DOS界面菜单式四则运算自编(菜单功能很不错宝贵资源)
2009-03-10
Vc6.0++MFC编程实例4讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例15讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例14讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例13讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例12讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例11讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例10讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例9讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例8讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例7讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例6讲解详细(宝贵资源)
2009-03-10
Vc6.0++MFC编程实例1讲解详细(宝贵资源)
2009-03-09
Vc6.0++MFC编程实例2讲解详细(宝贵资源)
2009-03-09
链表C语言实现 功能齐全
2009-03-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人