自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 【LeetCode】896. Monotonic Array

896. Monotonic ArrayProblemExampleSolution Problem 判断一个数组是否为单调不减或单调不增数组。 i <= j ,A[i] <= A[j] 或 i >= j , A[i] >= A[j] Example Input: [1,2,2,3] Output: true Input: [6,5,4,4] Output: tru...

2018-12-27 00:15:38 175

原创 【LeetCode】892. Surface Area of 3D Shapes

892. Surface Area of 3D ShapesProblemExampleSolution Problem 求3D图形的表面积。 二维数组v = grid[i][j],v表示图形的高,(i,j)表示所在的格子位置 Example 输入:[[2]] 输出:10 解释: 3D图形有4个侧面,面积都一样,两个上下面。S = 4 * h(高)+ 2 * 1 输入:[[1,2],[3,4...

2018-12-26 23:19:57 218

原创 【LeetCode】292. Nim Game

292. Nim GameProblemExampleSolution Problem 你和朋友在玩一个游戏,桌上有一堆石头,你俩每次轮流拿走1到3个石头,拿走最后剩余石头的就是赢家。你先开始拿。 你俩都很聪明,会选最佳策略。写一个方法,初始有多少个石头,你会赢。 Example 输入:4 输出:false 解释:不管你拿1,2,3个石头,剩下3,2,1个石头都会被朋友一次性拿光,所以输。 ...

2018-12-26 21:59:53 297

原创 【LeetCode】521. Longest Uncommon Subsequence I

521. Longest Uncommon Subsequence IProblemExampleSolution Problem 最长 不公共 子串 Example 输入:“aba”, “cdc” 输出:3 解释:左子串的最长子串为自己,右边也是,他们不相等,所以为3 输入:“asdf”,“asd” 输出:3 解释:左边最长字串为自己长度为4,右边最长为自己,长度为3,最长的不公共字串就为...

2018-12-26 21:43:16 137

原创 【LeetCode】917. Reverse Only Letters

917. Reverse Only LettersProblemExampleSolution Problem 给一个字符串,只反转其中的字母 Example Input: “ab-cd” Output: “dc-ba” Input: “a-bC-dEf-ghIj” Output: “j-Ih-gfE-dCba” Input: “Test1ng-Leet=code-Q!” Outpu...

2018-12-25 23:24:04 215

原创 【LeetCode】226. Invert Binary Tree

226. Invert Binary TreeProblemExampleSolution Problem 翻转二叉树 Example 输入: 4 / \ 2 7 / \ / \ 1 3 6 9 输出: 4 / \ 7 2 / \ / \ 9 6 3 1 Solution 递归的交换左右子树 /** ...

2018-12-25 23:02:12 135

原创 Tree

树的遍历前序遍历中序遍历后序遍历 “什么序” 遍历,对当前节点的操作就在“什么位置” 前序遍历 public void preorderTraversal(TreeNode root){ if (root != null) { System.out.println(root.val); preorderTraversal(root.left); preorderTra...

2018-12-25 21:52:10 231

原创 【LeetCode】693. Binary Number with Alternating Bits

693. Binary Number with Alternating BitsProblemExampleSolution Problem 给一个正整数,判断他的二进制形式 是否是0,1交替的 Example 5(101) true 7(111) false 10(1010) true 11(1011)false Solution 如果是最低位为0,如1010,先右移一位,方便计算 ...

2018-12-25 21:34:11 99

原创 【LeetCode】762. Prime Number of Set Bits in Binary Representation

Prime Number of Set Bits in Binary RepresentationProblemExampleSolution 一堆题放一块太挤了,还是分开放=.=,也能写得详细一点 Problem 求[L,R]这个闭区间内的数字 二进制表示形式 1的个数 为素数 的数量 Example L = 6, R = 10 6(0101),1的个数为2,2是素数 +1 7(1001)...

2018-12-24 21:37:37 178

原创 【LeetCode】Day5

文章目录412. Fizz Buzz953. Verifying an Alien Dictionary566. Reshape the Matrix104. Maximum Depth of Binary Tree136. Single Number429. N-ary Tree Level Order Traversal637. Average of Levels in Binary Tree...

2018-12-23 18:43:02 148

原创 【LeetCode】Day 4

文章目录500. Keyboard Row872. Leaf-Similar Trees893. Groups of Special-Equivalent Strings766. Toeplitz Matrix884. Uncommon Words from Two Sentences897. Increasing Order Search Tree463. Island Perimeter682...

2018-12-23 14:30:11 256

原创 数字字符串运算

文章目录500. Keyboard Row872. Leaf-Similar Trees893. Groups of Special-Equivalent Strings 500. Keyboard Row Given a List of words, return the words that can be typed using letters of alphabet on only one ...

2018-12-11 21:32:34 573

原创 【LeetCode】Day 3

文章目录933. Number of Recent Calls 933. Number of Recent Calls

2018-11-29 18:45:57 420

原创 【LeetCode】 Day 2

文章目录657. Robot Return to Origin461. Hamming Distance832. Flipping an Image617. Merge Two Binary Trees728. Self Dividing Numbers561. Array Partition I852. Peak Index in a Mountain Array942. DI String M...

2018-11-24 19:11:53 223

原创 【LeetCode】Day 1

文章目录771. Jewels and Stones929. Unique Email Addresses709. To Lower Case944. Delete Columns to Make Sorted804. Unique Morse Code Words905. Sort Array By Parity 771. Jewels and Stones 给一字符串 J (大小写敏感)和一...

2018-11-23 22:53:00 261

原创 新的一天

1024程序员节, 今天也刚好离职 表达能力太差,一直害怕写文章,始终无法下手。 如果不去尝试,不去写,明年的今天我还是不会。 程序员节,一个新的开始,踏出第一步。 ...

2018-10-24 20:57:05 182

原创 晚安,2017

2018,希望能交到很多好朋友。

2018-01-01 01:19:45 221

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除