随笔分类 -  剑指offer

摘要:#include #include typedef int Item;typedef struct node{ Item m_value; struct node* m_pLeft; struct node* m_pRight;}BinaryTreeNode;int getTree... 阅读全文
posted @ 2015-08-18 11:29 马小豆包 阅读(212) 评论(0) 推荐(0)
摘要:思路:二分法,分别找出第一个和最后一个k出现的位置。相减 加一#include //获取第一个K的位置int getFirstK (int k,int *numbers,int start,int end){ if(start > end){ return -1; ... 阅读全文
posted @ 2015-08-18 10:34 马小豆包 阅读(208) 评论(0) 推荐(0)
摘要:丑数:只有2 3 5 这三个因子的数,求前(第)1500个。习惯上我们把1当作第一个丑数例如 6, 8是丑数。14不是。#include int Min(int x,int y, int z){ int min = (x <= y) ? x : y; return min... 阅读全文
posted @ 2015-08-17 18:28 马小豆包 阅读(190) 评论(0) 推荐(0)
摘要:1 #include 2 3 void ReplaceBlank(char string[],int length){ 4 if(string == NULL || length == 0){ 5 return; 6 } 7 8... 阅读全文
posted @ 2015-08-12 13:49 马小豆包 阅读(246) 评论(0) 推荐(0)