<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[cocoapuff的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/cocoapuff</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; cocoapuff]]></copyright><item><title><![CDATA[Leetcode - String - Easy(14,28,58,125,344,383,387)]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/112858545</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/112858545</guid><author>cocoapuff</author><pubDate>Sat, 06 Feb 2021 09:43:17 +0800</pubDate><description><![CDATA[Longest Common Prefix
以第一个元素为基准值，挨个与其它元素进行比较。while 循环里面就是为了使基准值成为比较元素的起始字符串，故它不满足就每次截掉最后一位。若是全部截完了那就是无公共前缀了。

class Solution {
    public String longestCommonPrefix(String[] strs) {
        if(strs.length==0){return "";}
        String s = strs[0];
      .]]></description><category></category></item><item><title><![CDATA[Leetcode - Array -Easy (26,27,53,88,118,121,167,169,217,219,228,268,283）]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/112505944</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/112505944</guid><author>cocoapuff</author><pubDate>Wed, 20 Jan 2021 09:15:49 +0800</pubDate><description><![CDATA[Remove Duplicates from Sorted Array
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length.
Do not allocate extra space for another array, you must do this by modifying the input array.]]></description><category></category></item><item><title><![CDATA[Leetcode -Math - Easy(7,9,13,50,66,67,69,204)]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/112343856</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/112343856</guid><author>cocoapuff</author><pubDate>Tue, 12 Jan 2021 05:29:12 +0800</pubDate><description><![CDATA[Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer.
Note:
Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: −2^31 ~ 2^31 − 1. For the purpose of this problem, assume t.]]></description><category></category></item><item><title><![CDATA[Leetcode - Hash table - Easy (1,202)]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/112257983</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/112257983</guid><author>cocoapuff</author><pubDate>Fri, 08 Jan 2021 06:39:25 +0800</pubDate><description><![CDATA[虽然题目是从Hash Table tag里搜出来的，但用HashMap/HashSet只是解法之一，有些题目的奇技淫巧还需看其他解法，我尽量整理在一起。

Two Sum
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactl]]></description><category></category></item><item><title><![CDATA[Leetcode-Stack-Easy(20, 155, 225, 232)]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/112211479</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/112211479</guid><author>cocoapuff</author><pubDate>Wed, 06 Jan 2021 06:04:58 +0800</pubDate><description><![CDATA[Valid Parentheses
Given a string s containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.
对string遍历，左括号压栈，右括号检测栈不为空，且pop出来的是配对的符号，否则无效return false

//1 ms，37.2 MB
class Solution1 {
    public boolean isVali.]]></description><category></category></item><item><title><![CDATA[Leetcode - Tree - Easy(111-404)]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/112002212</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/112002212</guid><author>cocoapuff</author><pubDate>Tue, 05 Jan 2021 02:28:10 +0800</pubDate><description><![CDATA[Minimum Depth of Binary Tree
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

/**
 * DFS思路，代码比较简洁，但如果是左侧500个单链孩子，右侧1个孩子这种比较极端的情况，时间复杂度会太高
 * /
class Solution1 {
    public int minDepth(Tre.]]></description><category></category></item><item><title><![CDATA[Leetcode - Tree - Easy(100-110)]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/111885679</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/111885679</guid><author>cocoapuff</author><pubDate>Thu, 31 Dec 2020 05:26:29 +0800</pubDate><description><![CDATA[Same Tree
Given the roots of two binary trees p and q, write a function to check if they are the same or not.

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNod.]]></description><category></category></item><item><title><![CDATA[Leetcode-linkedlist-easy (141,237,83,160,203,206,207,234)]]></title><link>https://blog.youkuaiyun.com/cocoapuff/article/details/111772323</link><guid>https://blog.youkuaiyun.com/cocoapuff/article/details/111772323</guid><author>cocoapuff</author><pubDate>Tue, 29 Dec 2020 11:08:33 +0800</pubDate><description><![CDATA[Linked List Cycle
Given head, the head of a linked list, determine if the linked list has a cycle in it.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, .]]></description><category></category></item></channel></rss>