- 博客(17)
- 收藏
- 关注
原创 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 453
原创 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 470
原创 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 247
原创 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 339
原创 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 224
原创 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 348
原创 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 273
原创 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 305
原创 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 269
原创 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 217
原创 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 380
原创 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 290
原创 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 253
原创 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 594
原创 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 337
原创 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 423
原创 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 625
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人