<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[猩猩是个好程序员的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/Ypopstar</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; Ypopstar]]></copyright><item><title><![CDATA[LeetCode--1315--祖父节点值为偶数的节点和]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209740</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209740</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:54:15 +0800</pubDate><description><![CDATA[题目描述：
给你一棵二叉树，请你返回满足以下条件的所有节点的值之和：
该节点的祖父节点的值为偶数。（一个节点的祖父节点是指该节点的父节点的父节点。）
如果不存在祖父节点值为偶数的节点，那么返回 0 。

输入：
root = [6,7,8,2,7,1,3,9,null,1,4,null,null,null,5]
输出：
18
题意：
题目描述
题解：
直接用一个栈去模拟
代码：
/**
 * Definition for a binary tree node.
 * public class TreeNod]]></description><category></category></item><item><title><![CDATA[LeetCode--169--多数元素]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209701</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209701</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:52:41 +0800</pubDate><description><![CDATA[题目描述：
给定一个大小为 n 的数组，找到其中的多数元素。多数元素是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。
你可以假设数组是非空的，并且给定的数组总是存在多数元素。
输入：
[3,2,3]
[2,2,1,1,1,2,2]
输出：
3
2
题意：
题目描述
题解：
排序后直接输出len / 2
代码：
class Solution {
    public int majorityElement(int[] nums) {
        Arrays.sort(nums);
        re]]></description><category></category></item><item><title><![CDATA[LeetCode--112--路径总和]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209668</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209668</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:51:41 +0800</pubDate><description><![CDATA[题目描述：
给定一个二叉树和一个目标和，判断该树中是否存在根节点到叶子节点的路径，这条路径上所有节点值相加等于目标和。
输入：
5
/ 
4   8
/   / 
11  13  4
/  \      
7    2      1
sum = 22
输出：
true
题意：
题目描述
题解：
简单dfs，一步步搜
代码：
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     T]]></description><category></category></item><item><title><![CDATA[LeetCode--150--逆波兰表达式求值]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209620</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209620</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:50:38 +0800</pubDate><description><![CDATA[题目描述：
根据 逆波兰表示法，求表达式的值。
有效的运算符包括 +, -, , / 。每个运算对象可以是整数，也可以是另一个逆波兰表达式。
说明：
整数除法只保留整数部分。
给定逆波兰表达式总是有效的。换句话说，表达式总会得出有效数值且不存在除数为 0 的情况。
输入：
[“2”, “1”, “+”, “3”, ""]
[“4”, “13”, “5”, “/”, “+”]
[“10”, “6”, “9”, “3”, “+”, “-11”, “", “/”, "”, “17”, “+”, “5”, “+”]]]></description><category></category></item><item><title><![CDATA[LeetCode--1502--判断能否形成等差数列]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209592</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209592</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:49:20 +0800</pubDate><description><![CDATA[题目描述：
给你一个数字数组 arr 。
如果一个数列中，任意相邻两项的差总等于同一个常数，那么这个数列就称为 等差数列 。
如果可以重新排列数组形成等差数列，请返回 true ；否则，返回 false 。
输入：
arr = [3,5,1]
arr = [1,2,4]
输出：
true
false
题意：
题目描述
题解：
排个序，然后按照等差数列的定义判断
代码：
class Solution {
    public boolean canMakeArithmeticProgression(int[]]]></description><category></category></item><item><title><![CDATA[LeetCode--1486--数组异或操作]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209549</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209549</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:48:17 +0800</pubDate><description><![CDATA[题目描述：
给你两个整数，n 和 start 。
数组 nums 定义为：nums[i] = start + 2*i（下标从 0 开始）且 n == nums.length 。
请返回 nums 中所有元素按位异或（XOR）后得到的结果。
输入：
n = 5, start = 0
n = 4, start = 3
n = 1, start = 7
n = 10, start = 5
输出：
8
8
7
2
题意：
题目描述
题解：
直接搞
代码：
class Solution {
    public in]]></description><category></category></item><item><title><![CDATA[LeetCode--500--键盘行]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209502</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209502</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:46:55 +0800</pubDate><description><![CDATA[题目描述：
给定一个单词列表，只返回可以使用在键盘同一行的字母打印出来的单词。键盘如下图所示。

输入：
[“Hello”, “Alaska”, “Dad”, “Peace”]
输出：
[“Alaska”, “Dad”]
题意：
题目描述
题解：
直接搞
代码：
class Solution {
    public static String[] findWords(String[] words) {
        String a = "QWERTYUIOPqwertyuiop";
        S]]></description><category></category></item><item><title><![CDATA[LeetCode--561--数组拆分 I]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209475</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209475</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:45:42 +0800</pubDate><description><![CDATA[题目描述：
给定长度为 2n 的数组, 你的任务是将这些数分成 n 对, 例如 (a1, b1), (a2, b2), …, (an, bn) ，使得从1 到 n 的 min(ai, bi) 总和最大。
输入：
[1,4,3,2]
输出：
4
题意：
题目描述
题解：
简单贪心
排序后，两两找最小值
代码：
class Solution {
    public int arrayPairSum(int[] nums) {
        int sum = 0;
        Arrays.sort(n]]></description><category></category></item><item><title><![CDATA[LeetCode--1491-去掉最低工资和最高工资后的工资平均值]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209422</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209422</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:44:29 +0800</pubDate><description><![CDATA[题目描述：
给你一个整数数组 salary ，数组里每个数都是 唯一 的，其中 salary[i] 是第 i 个员工的工资。
请你返回去掉最低工资和最高工资以后，剩下员工工资的平均值。
输入：
salary = [4000,3000,1000,2000]
salary = [1000,2000,3000]
salary = [6000,5000,4000,3000,2000,1000]
salary = [8000,9000,2000,3000,6000,1000]
输出：
2500.00000
2000.]]></description><category></category></item><item><title><![CDATA[LeetCode--1475--商品折扣后的最终价格]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209379</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209379</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:43:00 +0800</pubDate><description><![CDATA[题目描述：
给你一个数组 prices ，其中 prices[i] 是商店里第 i 件商品的价格。
商店里正在进行促销活动，如果你要买第 i 件商品，那么你可以得到与 prices[j] 相等的折扣，其中 j 是满足 j &gt; i 且 prices[j] &lt;= prices[i] 的 最小下标 ，如果没有满足条件的 j ，你将没有任何折扣。
请你返回一个数组，数组中第 i 个元素是折扣后你购买商品 i 最终需要支付的价格。
输入：
prices = [8,4,6,2,3]
prices = [1,]]></description><category></category></item><item><title><![CDATA[LeetCode--905--按奇偶排序数组]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209339</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209339</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:41:38 +0800</pubDate><description><![CDATA[题目描述：
给定一个非负整数数组 A，返回一个数组，在该数组中， A 的所有偶数元素之后跟着所有奇数元素。
你可以返回满足此条件的任何数组作为答案。
输入：
[3,1,2,4]
输出：
[2,4,3,1]
题意：
题目描述
题解：
直接搞，先放偶数再放奇数
代码：
class Solution {
    public int[] sortArrayByParity(int[] A) {
        int len = A.length;
        int [] ans = new int [le]]></description><category></category></item><item><title><![CDATA[LeetCode--1108-- IP 地址无效化]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107209298</link><guid>https://blog.csdn.net/Ypopstar/article/details/107209298</guid><author>Ypopstar</author><pubDate>Wed, 08 Jul 2020 16:40:34 +0800</pubDate><description><![CDATA[题目描述：
给你一个有效的 IPv4 地址 address，返回这个 IP 地址的无效化版本。
所谓无效化 IP 地址，其实就是用 “[.]” 代替了每个 “.”。
输入：
address = “1.1.1.1”
address = “255.100.50.0”
输出：
“1[.]1[.]1[.]1”
“255[.]100[.]50[.]0”
题意：
题目描述
题解：
直接搞
代码：
class Solution {
    public String defangIPaddr(String address]]></description><category></category></item><item><title><![CDATA[堆空间内存大小和设置]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107189574</link><guid>https://blog.csdn.net/Ypopstar/article/details/107189574</guid><author>Ypopstar</author><pubDate>Tue, 07 Jul 2020 20:22:40 +0800</pubDate><description><![CDATA[package jvm;

/**
 * @Author CallMeDad
 * @create 2020/7/7 20:15
 */
public class initheap {

    /*
        默认情况下：
            初试内存大小为电脑物理内存 / 64
            最大内存大小为电脑物理内存 / 4
        设置堆空间大小参数：
        -Xms 用来设置堆空间（新生代 + 老年代）的初始内存大小
        -x 是jvm的运行参数
]]></description><category></category></item><item><title><![CDATA[关于Java虚拟机栈局部变最表slot的理解]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107175930</link><guid>https://blog.csdn.net/Ypopstar/article/details/107175930</guid><author>Ypopstar</author><pubDate>Tue, 07 Jul 2020 10:37:58 +0800</pubDate><description><![CDATA[局部变最表是一组变量值存储空间，用于存放方法参数和方法内部定义的局部变量。在 Java程序被编译为 Class文件时，就在方法的 Code属性的max_locals数据项中确定了该方法所需要分配的最大局部变量表的容量。
局部变量表的容量以变量槽（variable slot，下称slot）为最小单位，虚拟机规范中并没有明确指明一个slot应占用的内存空间大小，只是很有“导向性”地说明每个slot都应该能存放一个boolean、byte、char、short、int、float、reference或return]]></description><category></category></item><item><title><![CDATA[LeetCode--103--二叉树的锯齿形层次遍历]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107161762</link><guid>https://blog.csdn.net/Ypopstar/article/details/107161762</guid><author>Ypopstar</author><pubDate>Mon, 06 Jul 2020 16:27:08 +0800</pubDate><description><![CDATA[题目描述：
给定一个二叉树，返回其节点值的锯齿形层次遍历。（即先从左往右，再从右往左进行下一层遍历，以此类推，层与层之间交替进行）。
输入：
[3,9,20,null,null,15,7]
输出：
[
[3],
[20,9],
[15,7]
]
题意：
题目描述
题解：
简单bfs
队列中利用奇偶性判断一下是从前往后还是从后往前
代码：
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 ]]></description><category></category></item><item><title><![CDATA[LeetCode--5--最长回文子串]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107161735</link><guid>https://blog.csdn.net/Ypopstar/article/details/107161735</guid><author>Ypopstar</author><pubDate>Mon, 06 Jul 2020 16:25:35 +0800</pubDate><description><![CDATA[题目描述：
给定一个字符串 s，找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。
输入：
babad
cbbd
输出：
bab
bb
题意：
题目描述
题解：
直接搞
代码：
class Solution {
    public String longestPalindrome(String s) {
        int len = s.length();
        if (len &lt; 2) {
            return s;
        }

    ]]></description><category></category></item><item><title><![CDATA[LeetCode--96--不同的二叉搜索树]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107161704</link><guid>https://blog.csdn.net/Ypopstar/article/details/107161704</guid><author>Ypopstar</author><pubDate>Mon, 06 Jul 2020 16:24:44 +0800</pubDate><description><![CDATA[题目描述：
给定一个整数 n，求以 1 … n 为节点组成的二叉搜索树有多少种？
输入：
3
输出：
5
题意：
题目描述
题解：
卡特兰数
代码：
class Solution {
    public int numTrees(int n) {
        int[] G = new int[n + 1];
        G[0] = 1;
        G[1] = 1;
        for (int i = 2; i &lt;= n; ++i) {
            for (in]]></description><category></category></item><item><title><![CDATA[LeetCode--73--矩阵置零]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107161671</link><guid>https://blog.csdn.net/Ypopstar/article/details/107161671</guid><author>Ypopstar</author><pubDate>Mon, 06 Jul 2020 16:23:50 +0800</pubDate><description><![CDATA[题目描述：
给定一个 m x n 的矩阵，如果一个元素为 0，则将其所在行和列的所有元素都设为 0。请使用原地算法。
输入：
[
[1,1,1],
[1,0,1],
[1,1,1]
]
[
[0,1,2,0],
[3,4,5,2],
[1,3,1,5]
]
输出：
[
[1,0,1],
[0,0,0],
[1,0,1]
]
[
[0,0,0,0],
[0,4,5,0],
[0,3,1,0]
]
题意：
题目描述
题解：
开一个数组记录一下，哪些行和列需要修改，然后直接改就好了
代码：
class Solut]]></description><category></category></item><item><title><![CDATA[LeetCode--258--各位相加]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107161656</link><guid>https://blog.csdn.net/Ypopstar/article/details/107161656</guid><author>Ypopstar</author><pubDate>Mon, 06 Jul 2020 16:22:35 +0800</pubDate><description><![CDATA[题目描述：
给定一个非负整数 num，反复将各个位上的数字相加，直到结果为一位数。
输入：
38
输出：
2
题意：
题目描述
题解：
直接搞
代码：
class Solution {
    public int addDigits(int num) {
        int ans = num;
        while(true){
            ans = getDigits(ans);
            if(ans &lt; 10) return ans;
        }]]></description><category></category></item><item><title><![CDATA[LeetCode--26--删除排序数组中的重复项]]></title><link>https://blog.csdn.net/Ypopstar/article/details/107161598</link><guid>https://blog.csdn.net/Ypopstar/article/details/107161598</guid><author>Ypopstar</author><pubDate>Mon, 06 Jul 2020 16:21:39 +0800</pubDate><description><![CDATA[题目描述：
给定一个排序数组，你需要在 原地 删除重复出现的元素，使得每个元素只出现一次，返回移除后数组的新长度。
不要使用额外的数组空间，你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。
输入：
nums = [1,1,2]
nums = [0,0,1,1,1,2,2,3,3,4]
输出：
2
5
题意：
题目描述
题解：
直接搞
代码：
class Solution {
    public int removeDuplicates(int[] nums) {
        i]]></description><category></category></item></channel></rss>