- 博客(58)
- 收藏
- 关注
转载 AngularJS-2.依赖注入
AngularJS的一个强大之处就在于依赖注入。在调用bootstrap的时候,会调用createInjector来创建一个注射器进行注入。该方法的代码简化如下:function createInjector(modulesToLoad, strictDi) { strictDi = (strictDi === true); var INSTANTIATING = {},
2016-09-06 10:29:00
1061
转载 AngularJS-1.启动流程
整体结构bindJQuerypublishExternalAPIangularInit应用启动自动启动手动启动细节问题整体结构AngularJS的源码在整体上,与其它很多库和框架一样,是一个自执行函数,其整体结构简化如下:(function(window, document, undefined) { if (window.angular.bootstrap) {//判断是否已经
2016-09-02 17:16:14
2297
转载 常见http状态码
常见http状态码成功的状态码: 200 – 服务器成功返回网页 304 – 未修改 失败的状态码: 404 – 请求的网页不存在 503 – 服务器暂时不可用 500 – 服务器内部错误
2016-09-02 14:08:20
346
原创 LintCode-剑指Offer-(83)落单的数 II
**class Solution {public: /** * @param A : An integer array * @return : An integer */ int singleNumberII(vector &A) { // write your code here map
2015-12-05 14:25:16
481
原创 LintCode-剑指Offer-(71)二叉树的锯齿形层次遍历
class Solution { /** * @param root: The root of binary tree. * @return: A list of lists of integer include * the zigzag level order traversal of its nodes' values */public
2015-12-05 13:40:10
496
原创 LintCode-剑指Offer-(50)数组剔除元素后的乘积
class Solution {public: /** * @param A: Given an integers array A * @return: A long long array B and B[i]= A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1] */ vector<long long> productE
2015-12-05 13:04:50
276
原创 LintCode-剑指Offer-(112)删除排序链表中的重复元素
class Solution {public: /** * @param head: The first node of linked list. * @return: head node */ ListNode *deleteDuplicates(ListNode *head) { // write your code here
2015-12-05 12:56:30
375
原创 LintCode-剑指Offer-(54)转换字符串到整数
class Solution {public: /** * @param str: A string * @return An integer */ int atoi(string str) { // write your code here int sum=0; int i = str.length()-1;
2015-12-05 12:51:06
254
原创 LintCode-剑指Offer-(88)最近公共祖先
class Solution {public: /** * @param root: The root of the binary search tree. * @param A and B: two nodes in a Binary. * @return: Return the least common ancestor(LCA) of the two node
2015-12-05 12:30:59
387
原创 LintCode-剑指Offer-(56)两数之和
class Solution {public: /* * @param numbers : An array of Integer * @param target : target = numbers[index1] + numbers[index2] * @return : [index1+1, index2+1] (index1 < index2) */
2015-12-05 10:09:08
301
原创 LintCode-剑指Offer-(61)搜索区间
class Solution { /** *@param A : an integer sorted array *@param target : an integer to be inserted *return : a list of length 2, [index1, index2] */public: vector<int> search
2015-12-05 10:05:37
333
原创 LintCode-剑指Offer-(1)A+B问题
class Solution {public: /* * @param a: The first integer * @param b: The second integer * @return: The sum of a and b */ int aplusb(int a, int b) { // write your co
2015-12-05 09:59:08
304
原创 LintCode-剑指Offer-(8)旋转字符
class Solution {public: /** * @param str: a string * @param offset: an integer * @return: nothing */ void rotateString(string &str,int offset){ //wirte your code here
2015-12-05 09:56:56
251
原创 LintCode-剑指Offer-(53)翻转字符串
void split(std::string& s,std::string& delim,std::vector< std::string >* ret){ size_t last = 0; size_t index = s.find_first_of(delim,last); while (index!=std::string::npos) { r
2015-12-05 09:49:13
419
原创 LintCode-剑指Offer-(82)落单的数
class Solution {public: /** * @param A: Array of integers. * return: The single number. */ int singleNumber(vector<int> &A) { // write your code here int n=0;
2015-12-05 09:34:15
318
原创 LintCode-剑指Offer-(97)二叉树的最大深度
/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; * TreeNode(int val) { * this->val = val; * this->left = this->right =
2015-12-05 09:31:48
288
原创 LintCode-剑指Offer-(3)统计数字
class Solution {public: /* * param k : As description. * param n : As description. * return: How many k's between 0 and n. */ int countint(int k,int n){ int num = 0;
2015-12-05 09:23:40
632
原创 LintCode-剑指Offer-(4)丑数
class Solution {public: /* * @param k: The number k. * @return: The kth prime number as description. */ long long Min(long long i,long long j,long long k){ return min(i
2015-12-04 10:37:56
377
原创 LintCode-剑指Offer-(5)第k大元素
class Solution {public: /* * param k : description of k * param nums : description of array and index 0 ~ n-1 * return: description of return */ int kthLargestElement(int k,vec
2015-12-04 08:40:25
460
原创 LintCode-剑指Offer-(381)数倒置
vector<vector<int>> generateMatrix(const int n) { // Write your code here bool **IsVisited; IsVisited = new bool*[n]; vector<vector<int>> v; if (n==0)return v;
2015-12-04 08:33:47
662
原创 LintCode-剑指Offer-(380)两个链表的交叉
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: /** * @pa
2015-11-29 17:01:53
592
原创 LintCode-剑指Offer-(41)最大子数组
class Solution {public: /** * @param nums: A list of integers * @return: A integer indicate the sum of max subarray */ int maxSubArray(vector<int> nums) { // write your cod
2015-11-29 16:47:48
359
原创 LintCode-剑指Offer-(46)主元素
class Solution {public: /** * @param nums: A list of integers * @return: The majority number */ int majorityNumber(vector<int> nums) { // write your code here int n
2015-11-29 14:24:03
389
原创 LintCode-剑指Offer-(378)将二叉查找树转换成双链表
class Solution {public: /** * @param root: The root of tree * @return: the head of doubly list node */ DoublyListNode* bstToDoublyList(TreeNode* root) { // Write your code
2015-11-29 14:18:00
2204
原创 LintCode-剑指Offer-(374)螺旋矩阵
class Solution {public: /** * @param matrix a matrix of m x n elements * @return an integer array */ vector<int> spiralOrder(vector<vector<int>>& matrix) { // Write your co
2015-11-29 13:22:59
960
原创 LintCode-剑指Offer-(376)二叉树路径求和
/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; * TreeNode(int val) { * this->val = val; * this->left = this->right =
2015-11-29 12:27:48
448
原创 LintCode-剑指Offer-(105)复制带随机指针的链表
class Solution {public: /** * @param head: The head of linked list with a random pointer. * @return: A new head of a deep copy of the list. */ //递归真是个好东西,没想到真能用一个变量实现,简洁明了啊,非常好。
2015-11-22 02:25:50
1574
原创 LintCode-剑指Offer-(12)带最小值操作的栈
class MinStack {public: MinStack() { // do initialization if necessary } stack<int> s; stack<int> minstack; int minnum; void push(int number) { // write your co
2015-11-22 01:22:11
290
原创 LintCode-剑指Offer-(70)二叉树的层次遍历Ⅱ
class Solution { /** * @param root: The root of binary tree. * @return: Level order a list of lists of integer */ public: void lev(TreeNode* node, int levelnum, vector
2015-11-22 01:03:42
380
原创 LintCode-剑指Offer-(69)二叉树的层次遍历
class Solution { /** * @param root: The root of binary tree. * @return: Level order a list of lists of integer */public: void lev(TreeNode* node, int levelnum, vector<vector<int>>&
2015-11-22 01:00:56
297
原创 LintCode-剑指Offer-(68)二叉树的后序遍历
/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; * TreeNode(int val) { * this->val = val; * this->left = this->right =
2015-11-22 00:05:59
296
原创 LintCode-剑指Offer-(140)快速幂
class Solution {public: /* * @param a, b, n: 32bit integers * @return: An integer */ //要用long long类型,不然可能溢出 long long fastPower(long long a, long long b, long long n) {
2015-11-22 00:00:07
485
原创 LintCode-剑指Offer-(371)用递归打印数字
class Solution {public: /** * @param n: An integer. * return : An array storing 1 to the largest number with n digits. */ vector<int> numbersByRecursion(int n) { //我感觉这道题有点显得
2015-11-21 22:48:03
575
原创 LintCode-剑指Offer-(165)合并两个排序链表
class Solution {public: /** * @param ListNode l1 is the head of the linked list * @param ListNode l2 is the head of the linked list * @return: ListNode head of linked list */ L
2015-11-21 22:24:29
399
原创 LintCode-剑指Offer-(174)删除链表中倒数第n个节点
/** * Definition of ListNode * class ListNode { * public: * int val; * ListNode *next; * ListNode(int val) { * this->val = val; * this->next = NULL; * } * } *
2015-11-21 20:43:53
272
原创 LintCode-剑指Offer-(245)子树
class Solution {public: /** * @param T1, T2: The roots of binary tree. * @return: True if T2 is a subtree of T1, or false. */ bool isSubtree(TreeNode *T1, TreeNode *T2) { if
2015-11-21 20:29:12
290
原创 LintCode-剑指Offer-(372)在O(1)时间复杂度删除链表节点
/** * Definition of ListNode * class ListNode { * public: * int val; * ListNode *next; * ListNode(int val) { * this->val = val; * this->next = NULL; * } * } *
2015-11-21 17:44:14
323
原创 LintCode-剑指Offer-(373)奇偶分割数组
class Solution {public: /** * @param nums: a vector of integers * @return: nothing */ void partitionArray(vector<int> &nums) { // write your code here int i=0;
2015-11-21 17:32:17
898
原创 LintCode-剑指Offer-(73)前序遍历和中序遍历树构造二叉树
class Solution { /**' * ' *@param preorder : A list of integers that preorder traversal of a tree *@param inorder : A list of integers that inorder traversal of a tree *@return : Ro
2015-11-21 17:05:29
325
原创 LintCode-剑指Offer-(160)寻找旋转排序数组中的最小值Ⅱ
class Solution {public: /** * @param num: the rotated sorted array * @return: the minimum number in the array */ int findMin(vector<int> &num) { // write your code here
2015-11-21 01:51:58
290
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人