<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[allforwhat的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/allforwhat</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; allforwhat]]></copyright><item><title><![CDATA[[leetcode 190]Reverse Bits]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44676661</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44676661</guid><author>allforwhat</author><pubDate>Fri, 27 Mar 2015 14:42:31 +0800</pubDate><description><![CDATA[Reverse bits of a given 32 bits unsigned integer.

For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as0011100101]]></description><category></category></item><item><title><![CDATA[[leecode 190]Reverse digits of an integer.Reverse digits of an integer.]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44425105</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44425105</guid><author>allforwhat</author><pubDate>Wed, 18 Mar 2015 22:02:01 +0800</pubDate><description><![CDATA[反转很容易实现，难的是对异常case的考虑。
比如如果没有示例，你是否会考虑到负数的情况。
10,100这个可以在写代码前问下面试官或者在代码里写明，表示你考虑到了这种情况。
然后就是有可能溢出！！


Reverse digits of an integer.

Example1: x = 123, return 321
Example2: x = -123, return -]]></description><category></category></item><item><title><![CDATA[[leetcode 191]Number of 1 Bits]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44422851</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44422851</guid><author>allforwhat</author><pubDate>Wed, 18 Mar 2015 21:17:42 +0800</pubDate><description><![CDATA[Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming
 weight).

For example, the 32-bit integer ’11' has binary representation 000000]]></description><category></category></item><item><title><![CDATA[[leetcode 168]Excel Sheet Column Title]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44341501</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44341501</guid><author>allforwhat</author><pubDate>Tue, 17 Mar 2015 14:38:27 +0800</pubDate><description><![CDATA[Given a positive integer, return its corresponding column title as appear in an Excel sheet.

For example:
    1 -> A
    2 -> B
    3 -> C
    ...
    26 -> Z
    27 -> AA
    28 -> AB 

考虑下这个正整]]></description><category></category></item><item><title><![CDATA[[leetcode #3待续]Longest Substring Without Repeating Characters]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44340289</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44340289</guid><author>allforwhat</author><pubDate>Tue, 17 Mar 2015 13:11:09 +0800</pubDate><description><![CDATA[Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without
 repeating letters for "abcabcbb" is "abc", which the length is 3. Fo]]></description><category></category></item><item><title><![CDATA[[leetcode #20 stack]Valid Parentheses]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44262355</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44262355</guid><author>allforwhat</author><pubDate>Sat, 14 Mar 2015 19:12:48 +0800</pubDate><description><![CDATA[Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
 determine if the input string is valid.

The brackets must close in the correct order, "()" and "()[]{}" are
 all va]]></description><category></category></item><item><title><![CDATA[[leetcode160链表]Intersection of Two Linked Lists]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44224643</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44224643</guid><author>allforwhat</author><pubDate>Thu, 12 Mar 2015 17:25:31 +0800</pubDate><description><![CDATA[Write a program to find the node at which the intersection of two singly linked lists begins.



For example, the following two linked lists:
A:          a1 → a2
                   ↘
            ]]></description><category></category></item><item><title><![CDATA[[leetcode 147]Insertion Sort List]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44223535</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44223535</guid><author>allforwhat</author><pubDate>Thu, 12 Mar 2015 16:31:14 +0800</pubDate><description><![CDATA[Sort a linked list using insertion sort.


/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };]]></description><category></category></item><item><title><![CDATA[[leetoce 143 链表]Reorder List]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44221787</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44221787</guid><author>allforwhat</author><pubDate>Thu, 12 Mar 2015 14:56:37 +0800</pubDate><description><![CDATA[Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…

You must do this in-place without altering the nodes' values.

For example,
Given {1,2,3,4}, reorder it to ]]></description><category></category></item><item><title><![CDATA[[leetcode141	142]Linked List Cycle I II]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44220491</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44220491</guid><author>allforwhat</author><pubDate>Thu, 12 Mar 2015 13:22:49 +0800</pubDate><description><![CDATA[1 Given a linked list, determine if it has a cycle in it.

Follow up:
Can you solve it without using extra space?

如何求环的长度，记住碰撞点的指针，让slow指针不停向后遍历，当再次回到碰撞点时走过的距离就是环的长度。

碰撞点到环节点 = 头结点到环节点

设环外]]></description><category></category></item><item><title><![CDATA[[leetcode 92]Reverse Linked List II]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44219801</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44219801</guid><author>allforwhat</author><pubDate>Thu, 12 Mar 2015 11:46:50 +0800</pubDate><description><![CDATA[Reverse a linked list from position m to n. Do it in-place and in one-pass.

For example:
Given 1->2->3->4->5->NULL, m = 2 and n = 4,

return 1->4->3->2->5->NULL.

Note:
Given m, n satisfy the]]></description><category></category></item><item><title><![CDATA[[leetcode #86 链表]	Partition List]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44219297</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44219297</guid><author>allforwhat</author><pubDate>Thu, 12 Mar 2015 11:14:50 +0800</pubDate><description><![CDATA[Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.

You should preserve the original relative order of the nodes in each of]]></description><category></category></item><item><title><![CDATA[[leetcode 83]Remove Duplicates from Sorted List]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44202657</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44202657</guid><author>allforwhat</author><pubDate>Wed, 11 Mar 2015 18:47:11 +0800</pubDate><description><![CDATA[Given a sorted linked list, delete all duplicates such that each element appear only once.

For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.







class Solut]]></description><category></category></item><item><title><![CDATA[[leetcode 82]Remove Duplicates from Sorted List II]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44201969</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44201969</guid><author>allforwhat</author><pubDate>Wed, 11 Mar 2015 17:44:50 +0800</pubDate><description><![CDATA[Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.

For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1-]]></description><category></category></item><item><title><![CDATA[[leetcode #61]Rotate List]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44201337</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44201337</guid><author>allforwhat</author><pubDate>Wed, 11 Mar 2015 17:00:37 +0800</pubDate><description><![CDATA[Given a list, rotate the list to the right by k places, where k is non-negative.

For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.

需要考虑k大于链表长度，主流的方法是将链表成环然后找到位置然后断环]]></description><category></category></item><item><title><![CDATA[[leetcode #25]Reverse Nodes in k-Group]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44200367</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44200367</guid><author>allforwhat</author><pubDate>Wed, 11 Mar 2015 16:13:01 +0800</pubDate><description><![CDATA[Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.

If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is]]></description><category></category></item><item><title><![CDATA[[Leetcode 24 链表]Swap Nodes in Pairs]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44198763</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44198763</guid><author>allforwhat</author><pubDate>Wed, 11 Mar 2015 14:51:00 +0800</pubDate><description><![CDATA[Given a linked list, swap every two adjacent nodes and return its head.

For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.

Your algorithm should use only constant space. Y]]></description><category></category></item><item><title><![CDATA[[#23 leetcode]Merge k Sorted Lists]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44198173</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44198173</guid><author>allforwhat</author><pubDate>Wed, 11 Mar 2015 14:14:39 +0800</pubDate><description><![CDATA[方法1：一开始想到的方法，每次都要遍历一遍vector.时间复杂度很高，如果每个链表都只有一个元素，但是有很多个链表。class Solution {
public:
    ListNode *mergeKLists(vector &lists) {
        ListNode head(0);
        ListNode *p = &head;
        ListNode *]]></description><category></category></item><item><title><![CDATA[leetcode[21 链表]Merge Two Sorted Lists]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44180837</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44180837</guid><author>allforwhat</author><pubDate>Tue, 10 Mar 2015 21:01:07 +0800</pubDate><description><![CDATA[Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first
 two lists.
很简单的题目，第一次刷的时候不知道加个头结点，代码如下，自己写的再看都觉得很难阅读，不够清晰。因为第一个节点是]]></description><category></category></item><item><title><![CDATA[leetcode[#19 链表 标尺]Remove Nth Node From End of List]]></title><link>https://blog.youkuaiyun.com/allforwhat/article/details/44177691</link><guid>https://blog.youkuaiyun.com/allforwhat/article/details/44177691</guid><author>allforwhat</author><pubDate>Tue, 10 Mar 2015 16:59:34 +0800</pubDate><description><![CDATA[Given a linked list, remove the nth node from the end of list and return its head.

For example,
   Given linked list: 1->2->3->4->5, and n = 2.

   After removing the second node from the end, the]]></description><category></category></item></channel></rss>