<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[duang0626的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/duang0626</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; duang0626]]></copyright><item><title><![CDATA[Intent详解]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79477578</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79477578</guid><author>duang0626</author><pubDate>Wed, 07 Mar 2018 21:51:37 +0800</pubDate><description><![CDATA[自助者天助—Intent详解

一篇关于intent非常详细的博客，因为不能直接从博客园转载博客到csdn,就只好采用这种方式，上面是博客链接。]]></description><category></category></item><item><title><![CDATA[Activity生命周期详解]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79465527</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79465527</guid><author>duang0626</author><pubDate>Wed, 07 Mar 2018 00:00:16 +0800</pubDate><description><![CDATA[关于Activity

在Android应用程序里，一个Activity就是一个用户界面。用户与程序的交互就是通过Activity来实现的，可以看成网站的页面。主Activity是程序启动的入口。应用程序成功启动之后，呈献给用户的第一个界面，即为该程序的主Activity。



Activity的四种状态

Android 的虚拟机(VM)是使用基于栈(Stack based) 管理，主要有四种...]]></description><category></category></item><item><title><![CDATA[牛客网剑指offer—顺时针打印矩阵]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79346718</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79346718</guid><author>duang0626</author><pubDate>Thu, 22 Feb 2018 13:09:09 +0800</pubDate><description><![CDATA[描述：

输入一个矩阵，按照从外向里以顺时针的顺序依次打印出每一个数字，例如，如果输入如下矩阵： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数字1,2,3,4,8,12,16,15,14,13,9,5,6,7,11,10.



思路：

感觉这道题是第一页20道题里面最难的了，我也想不到什么好的办法，只有老老实实地用几个循环进行处理。 
我们通过分...]]></description><category></category></item><item><title><![CDATA[牛客网剑指offer—合并两个排序的链表]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79344386</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79344386</guid><author>duang0626</author><pubDate>Wed, 21 Feb 2018 21:48:01 +0800</pubDate><description><![CDATA[描述：

输入两个单调递增的链表，输出两个链表合成后的链表，当然我们需要合成后的链表满足单调不减规则。



思路1：

使用递归，递归的思路非常简单，先比较当前两个链表“首结点”的值，把有较小值的节点插入到新的链表，然后将除去这个结点的剩余链表和另一个链表进行递归，具体的代码如下：

class Solution {
public:
    ListNode* Merge(ListNode* p...]]></description><category></category></item><item><title><![CDATA[通过一个c++程序来理解两个指针的赋值]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79343310</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79343310</guid><author>duang0626</author><pubDate>Wed, 21 Feb 2018 16:44:33 +0800</pubDate><description><![CDATA[c++程序如下：

#include &amp;lt;iostream&amp;gt;

using namespace std;

struct ListNode {
    int val;
    struct ListNode *next;
    ListNode(int x) :
            val(x), next(NULL) {
    }
};

int main() {
    L...]]></description><category></category></item><item><title><![CDATA[牛客网剑指offer—反转链表]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79343215</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79343215</guid><author>duang0626</author><pubDate>Wed, 21 Feb 2018 16:26:17 +0800</pubDate><description><![CDATA[描述：

输入一个链表，反转链表后，输出链表的所有元素。



思路1：

用一个栈将链表的所有结点先保存下来，然后在赋给新的链表。 
最开始就是使用的这种方法，利用了栈的特性，就是空间复杂度比较高。



class Solution {
public:
    ListNode* ReverseList(ListNode* pHead) {
        if(pHead == NULL |...]]></description><category></category></item><item><title><![CDATA[牛客网剑指offer—链表中倒数第k个结点]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79342568</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79342568</guid><author>duang0626</author><pubDate>Wed, 21 Feb 2018 12:53:14 +0800</pubDate><description><![CDATA[描述：

输入一个链表，输出该链表中倒数第k个结点。

思路1：

我么都知道链表是不计数的，没有处理的情况下是不知道链表的结点个数的。因此最开始拿到这道题的想法就是想去计算得到链表的结点个数，知道结点个数后要求就很好达到了，这种想法下可以有以下代码：



class Solution {
public:
    ListNode* FindKthToTail(ListNode* pListHe...]]></description><category></category></item><item><title><![CDATA[牛客网剑指offer—调整数组顺序使奇数位于偶数前面]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79342388</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79342388</guid><author>duang0626</author><pubDate>Wed, 21 Feb 2018 11:47:02 +0800</pubDate><description><![CDATA[描述：

输入一个整数数组，实现一个函数来调整该数组中数字的顺序，使得所有的奇数位于数组的前半部分，所有的偶数位于位于数组的后半部分，并保证奇数和奇数，偶数和偶数之间的相对位置不变。



思路：

这道题我能想到的方法时间复杂度最小为O(n)，想了一下，应该也没有其他时间复杂度更小的方法了，具体有两种思路：



思路1：

再开一个vector容器，遍历两次，第一次保存奇数列，第二次保存偶数列...]]></description><category></category></item><item><title><![CDATA[使用非递归的方式实现斐波那契数列]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79341617</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79341617</guid><author>duang0626</author><pubDate>Wed, 21 Feb 2018 01:27:30 +0800</pubDate><description><![CDATA[斐波那契数列一般是大家学习递归的入门课，斐波那契数列可以帮助大家很容易的理解递归，但是使用递归的方法有一个缺点，就是对于一个确定的n，他的值往往会被计算很多次，因此当你对算法的时间复杂度要求比较高的时候，递归的方法就不能胜任，这个时候可以采用迭代的方法来实现斐波那契数列，具体的代码如下，很容易理解：

实现1：

class Solution {
public:
    int Fibonacci...]]></description><category></category></item><item><title><![CDATA[牛客网剑指offer—旋转数组的最小数字]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79341589</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79341589</guid><author>duang0626</author><pubDate>Wed, 21 Feb 2018 01:04:56 +0800</pubDate><description><![CDATA[描述：

把一个数组最开始的若干个元素搬到数组的末尾，我们称之为数组的旋转。 输入一个非递减排序的数组的一个旋转，输出旋转数组的最小元素。 例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转，该数组的最小值为1。 NOTE：给出的所有元素都大于0，若数组大小为0，请返回0。



思路：

这道题的大概思路主要有以下几种： 
1，最普通的方法，直接按照普通数组的处理，获取数组的最小值...]]></description><category></category></item><item><title><![CDATA[个人理解——为什么要学习算法]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79288650</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79288650</guid><author>duang0626</author><pubDate>Thu, 08 Feb 2018 13:32:58 +0800</pubDate><description><![CDATA[在程序设计题的时候经常会遇到一下问题：


根本没有解决问题的思路
有思路但是设计不出算法
设计出了算法但是算法复杂度太高了


针对以上问题，希望通过学习算法达到以下目的：


设计高效且正确的算法
正确的实现


并且，为了设计算法，同时锻炼


灵活的想象力
算法的基础知识
...]]></description><category></category></item><item><title><![CDATA[TeXstudio 安装中的一些问题]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79241840</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79241840</guid><author>duang0626</author><pubDate>Fri, 02 Feb 2018 17:50:43 +0800</pubDate><description><![CDATA[问题

如果安装好TeXstudio运行出现以下报错的话，就很有可能和我遇到了同样的问题，下面是这个问题的一个可能的解决方法，希望能够帮助到你。

Make sure that you have installed a (La)TeX distribution e.g. MiKTeX or TeX Live, and have set the correct paths to this distr...]]></description><category></category></item><item><title><![CDATA[字符串的移位包含问题]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79156498</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79156498</guid><author>duang0626</author><pubDate>Wed, 24 Jan 2018 22:42:14 +0800</pubDate><description><![CDATA[题目描述：

给定两个字符串s1和s2,要求判断s2是否能够被s1做循环移位(rotate)得到字符串的包含。例如 s1 = AABCD和s2 = CDAA,返回true;给定s1 = ABCD 和 s2 = ACBD,返回false。

循环移位： 即对于一个长度为N的字符串数组，把下标为0的字符放到下标为1的字符的位置，把下标为1的字符放到下标为2的字符的位置，……把下标为N-2的字符放到下标]]></description><category></category></item><item><title><![CDATA[[LeetCode] Algorithms-45. 230. Kth Smallest Element in a BST]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79053413</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79053413</guid><author>duang0626</author><pubDate>Sat, 13 Jan 2018 20:02:03 +0800</pubDate><description><![CDATA[描述：

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.

Note:  
You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.

Follow up: 
What if the]]></description><category></category></item><item><title><![CDATA[[LeetCode] Algorithms-45. 123. Best Time to Buy and Sell Stock III]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79053180</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79053180</guid><author>duang0626</author><pubDate>Sat, 13 Jan 2018 19:16:13 +0800</pubDate><description><![CDATA[描述：

Say you have an array for which the ith element is the price of a given stock on day i.

Design an algorithm to find the maximum profit. You may complete at most two transactions.

Note: 
You may]]></description><category></category></item><item><title><![CDATA[[LeetCode] Algorithms-122. Best Time to Buy and Sell Stock II]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79039721</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79039721</guid><author>duang0626</author><pubDate>Fri, 12 Jan 2018 00:05:47 +0800</pubDate><description><![CDATA[描述：

Say you have an array for which the ith element is the price of a given stock on day i.

Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy]]></description><category></category></item><item><title><![CDATA[[LeetCode] Algorithms-121. Best Time to Buy and Sell Stock]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79039660</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79039660</guid><author>duang0626</author><pubDate>Thu, 11 Jan 2018 23:46:03 +0800</pubDate><description><![CDATA[描述：

Say you have an array for which the ith element is the price of a given stock on day i.

If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stoc]]></description><category></category></item><item><title><![CDATA[[LeetCode] Algorithms-63. Unique Paths II]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79037041</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79037041</guid><author>duang0626</author><pubDate>Thu, 11 Jan 2018 18:01:10 +0800</pubDate><description><![CDATA[描述：

Follow up for “Unique Paths”:

Now consider if some obstacles are added to the grids. How many unique paths would there be?

An obstacle and empty space is marked as 1 and 0 respectively in the g]]></description><category></category></item><item><title><![CDATA[[LeetCode] Algorithms-62. Unique Paths]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79033661</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79033661</guid><author>duang0626</author><pubDate>Thu, 11 Jan 2018 14:18:21 +0800</pubDate><description><![CDATA[描述：

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).

The robot can only move either down or right at any point in time. The robot is trying to reach t]]></description><category></category></item><item><title><![CDATA[[LeetCode] Algorithms-45. Jump Game II]]></title><link>https://blog.youkuaiyun.com/duang0626/article/details/79032892</link><guid>https://blog.youkuaiyun.com/duang0626/article/details/79032892</guid><author>duang0626</author><pubDate>Thu, 11 Jan 2018 12:55:57 +0800</pubDate><description><![CDATA[描述

Given an array of non-negative integers, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Your goal i]]></description><category></category></item></channel></rss>