<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[tuzimi的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/tuzimi</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; tuzimi]]></copyright><item><title><![CDATA[171. Excel Sheet Column Number]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70555524</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70555524</guid><author>tuzimi</author><pubDate>Sun, 23 Apr 2017 22:53:22 +0800</pubDate><description><![CDATA[Given a column title as appear in an Excel sheet, return its corresponding column number.For example:
  数字
  
  字母  A
  ->
  1
  B
  ->
  2
  Z
  ->
  26
  AA
  ->
  27  这题目使用递归就可以，但需要注意数组不是从0开始的。
/**]]></description><category></category></item><item><title><![CDATA[168. Excel Sheet Column Title]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70550665</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70550665</guid><author>tuzimi</author><pubDate>Sun, 23 Apr 2017 21:53:36 +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
  26
  ->
  Z
  27
  ->
  AA  这题目使用递归就可以，但需要注意数组不是从0开始的。
/]]></description><category></category></item><item><title><![CDATA[202. Happy Number]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70500139</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70500139</guid><author>tuzimi</author><pubDate>Sun, 23 Apr 2017 14:46:33 +0800</pubDate><description><![CDATA[Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of i]]></description><category></category></item><item><title><![CDATA[258. Add Digits]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70306522</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70306522</guid><author>tuzimi</author><pubDate>Thu, 20 Apr 2017 23:14:40 +0800</pubDate><description><![CDATA[Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
  For example: 
  Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one d]]></description><category></category></item><item><title><![CDATA[3. Longest Substring Without Repeating Characters]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70261825</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70261825</guid><author>tuzimi</author><pubDate>Thu, 20 Apr 2017 15:39:15 +0800</pubDate><description><![CDATA[Given a string, find the length of the longest substring without repeating characters.
  题目解读：给出一个字符串的最长连续不重复字符串。注意，dvdf 给出的结果是3！
  
  所以基本思想就是：
/**
 * @param {string} s
 * @return {number}
 */
var len]]></description><category></category></item><item><title><![CDATA[111. Minimum Depth of Binary Tree]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70249653</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70249653</guid><author>tuzimi</author><pubDate>Wed, 19 Apr 2017 23:57:17 +0800</pubDate><description><![CDATA[Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
  求二叉树最小深度，注意是叶子节点距离跟节点的最小深度。
/**
 * Defin]]></description><category></category></item><item><title><![CDATA[104. Maximum Depth of Binary Tree]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70248882</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70248882</guid><author>tuzimi</author><pubDate>Wed, 19 Apr 2017 23:36:34 +0800</pubDate><description><![CDATA[Given a binary tree, find its maximum depth. 
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
  求二叉树的最大深度
/**
 * Definition for a bina]]></description><category></category></item><item><title><![CDATA[520. Detect Capital]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70246239</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70246239</guid><author>tuzimi</author><pubDate>Wed, 19 Apr 2017 22:34:18 +0800</pubDate><description><![CDATA[Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:
All letters in this word]]></description><category></category></item><item><title><![CDATA[557. Reverse Words in a String III]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70246018</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70246018</guid><author>tuzimi</author><pubDate>Wed, 19 Apr 2017 22:14:28 +0800</pubDate><description><![CDATA[Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
  Example 1: 
  Input: “Let’s take LeetCode contest”]]></description><category></category></item><item><title><![CDATA[splice、split，slice区分]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/70038102</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/70038102</guid><author>tuzimi</author><pubDate>Mon, 10 Apr 2017 22:17:52 +0800</pubDate><description><![CDATA[这几个函数非常容易混淆，这里做一个对比用于Array 对象
  功能
  语法
  参数  slice()
  arrayObject.slice(start,end)
  返回一个新的数组，包含从 start 到 end （不包括该元素）的 arrayObject 中的元素。
  splice()
  arrayObject.splice(index,howmany,item1,…..,itemX]]></description><category></category></item><item><title><![CDATA[541. Reverse String II]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69997173</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69997173</guid><author>tuzimi</author><pubDate>Mon, 10 Apr 2017 19:02:30 +0800</pubDate><description><![CDATA[Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them.]]></description><category></category></item><item><title><![CDATA[344. Reverse String]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69962285</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69962285</guid><author>tuzimi</author><pubDate>Mon, 10 Apr 2017 17:54:13 +0800</pubDate><description><![CDATA[Write a function that takes a string as input and returns the string reversed. 
Example: 
Given s = “hello”, return “olleh”. 
  这个题目如果使用JS的数组就很方便，因为数组有一个reverse 的方法。
var reverseString = function(s) {]]></description><category></category></item><item><title><![CDATA[167. Two Sum II - Input array is sorted]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69945115</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69945115</guid><author>tuzimi</author><pubDate>Mon, 10 Apr 2017 11:54:31 +0800</pubDate><description><![CDATA[Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers suc]]></description><category></category></item><item><title><![CDATA[283. Move Zeroes]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69944435</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69944435</guid><author>tuzimi</author><pubDate>Mon, 10 Apr 2017 11:14:45 +0800</pubDate><description><![CDATA[Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your funct]]></description><category></category></item><item><title><![CDATA[27. Remove Element]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69944111</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69944111</guid><author>tuzimi</author><pubDate>Mon, 10 Apr 2017 11:00:42 +0800</pubDate><description><![CDATA[Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The order]]></description><category></category></item><item><title><![CDATA[203. Remove Linked List Elements]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69938881</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69938881</guid><author>tuzimi</author><pubDate>Sun, 09 Apr 2017 23:00:50 +0800</pubDate><description><![CDATA[Remove all elements from a linked list of integers that have value val.
  这个题目本想采用递归的方法，但是发现当前节点的前一个节点不好获取，所以采用非递归的方法。 
  在while循环里，每次判断当前节点的下一个节点值是否为所需值，然后删除起来就比较方便了
/**
 * Definition for singly-linke]]></description><category></category></item><item><title><![CDATA[83. Remove Duplicates from Sorted List]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69933839</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69933839</guid><author>tuzimi</author><pubDate>Sun, 09 Apr 2017 21:04:14 +0800</pubDate><description><![CDATA[Given a sorted linked list, delete all duplicates such that each element appear only once.
  这个题目采用了两种方法，一种递归，一种循环，其实原理都差不多。就是一个个找下一个的值是否和当前节点的值相同，若相同则删除，若不同，则继续检查下一个节点。
//方法一
var deleteDuplicates = fu]]></description><category></category></item><item><title><![CDATA[109. Convert Sorted List to Binary Search Tree]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69831423</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69831423</guid><author>tuzimi</author><pubDate>Sun, 09 Apr 2017 16:23:11 +0800</pubDate><description><![CDATA[Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
  这个题目和 108 很像，只是108本身就是有序数组转化为平衡二叉树，这里是链表转化为平衡二叉树，所以首先的想法就是把有序链表转化为有序数组，在使用 108 的函数得到答案。]]></description><category></category></item><item><title><![CDATA[108. Convert Sorted Array to Binary Search Tree]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69808408</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69808408</guid><author>tuzimi</author><pubDate>Sun, 09 Apr 2017 12:54:12 +0800</pubDate><description><![CDATA[Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
  题目是说将一个排好序的数组变成一个平衡二叉树，那么采用递归的思想就是： 
  当数组为空，则返回空，当数组长度为1，则返回这一个元素所创造的TreeNode，当数组长度大于1，那么就将数组分成两个部分，]]></description><category></category></item><item><title><![CDATA[236. Lowest Common Ancestor of a Binary Tree]]></title><link>https://blog.youkuaiyun.com/tuzimi/article/details/69789319</link><guid>https://blog.youkuaiyun.com/tuzimi/article/details/69789319</guid><author>tuzimi</author><pubDate>Sat, 08 Apr 2017 23:51:53 +0800</pubDate><description><![CDATA[Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
  注意这里是普通的二叉树，没有顺序的，所以就要老老实实的查找。 
  如果跟节点和要查找的节点为空，就返回空，如果要查找的节点不存在于左边，就在右边找，如果不存在于右边，就在左边找，否则就是一左一右，那么就返回当前跟节]]></description><category></category></item></channel></rss>