- 博客(24)
- 资源 (3)
- 收藏
- 关注
原创 LeetCode-226. Invert Binary Tree
226. Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this
2017-10-28 22:20:24 175
原创 LeetCode-104. Maximum Depth of Binary Tree
104. Maximum Depth of Binary TreeGiven 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
2017-10-27 10:33:46 177
原创 LeetCode-695. Max Area of Island
695. Max Area of IslandGiven a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all
2017-10-27 09:46:03 412
原创 leetcode-485. Max Consecutive Ones
485. Max Consecutive OnesGiven a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the
2017-10-25 17:09:58 179
原创 LeetCode-693. Binary Number with Alternating Bits
693. Binary Number with Alternating BitsGiven a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.Example 1:Input:
2017-10-25 14:53:35 496
原创 leetcode-690. Employee Importance
690. Employee ImportanceYou are given a data structure of employee information, which includes the employee's unique id, his importance value and his directsubordinates' id.For example,
2017-10-24 17:08:59 233
原创 <leetcode>637. Average of Levels in Binary Tree
637. Average of Levels in Binary TreeGiven a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3 / \ 9 20
2017-10-23 19:49:38 232
原创 <leetcode> 521. Longest Uncommon Subsequence I
521. Longest Uncommon Subsequence IGiven a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defined as
2017-10-22 09:28:35 141
原创 Github Desktop for Windows 10 安装教程
现在的github desktop的网页好像被q了,这里给出离线下载地址:github desktop离线下载(截止17.10.21还是可以下载的)1.下载完成后,点击打开2.打开后,会在当前目录生成如下目录:3.把此目录移动到你想安装的目录,打开目录,点击setup4.安装完成啦
2017-10-21 14:58:37 6995
原创 IntelliJ IDEA添加额外的jar包
在编写Java程序的时候,有时要添加别人的jar,以下就是步骤:1.在打开你的project的情况下,点击File,选择Project Structure2.选择Modules,选择Dependencies,再选择+,找到你要填加的jar包就可以了
2017-10-21 12:47:44 1200
原创 Java取余操作时的符号问题
上课时只听老师说过,Java取余的操作的符号位是和被除数一致的,但不知道为啥例如:-14%3 余数是 -214%-3 余数是 2后来才知道,对余数的定义是 (a/b)*b + a%b 恒等于 a这样的话,-14/3*3的结果是-4*3 = -12,所以余数是-2;14%3同理啦
2017-10-21 10:30:01 1255
原创 递归的基本原则
编写递归时,最重要的有以下三点:递归总有一个最简单的情况——方法的第一条语句总是包含一个return的条件语句递归调用总是尝试解决一个规模更小的子问题,这样递归才能收敛到最简单的情况。递归调用的父问题和尝试解决的子问题之间不应该有交集。违背以上原则写出的代码可能是错误的或者低效的。
2017-10-21 09:44:27 1049
原创 <leetcode>617. Merge Two Binary Trees
617. Merge Two Binary TreesGiven two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to
2017-10-20 10:47:06 191
原创 <leetcode>496. Next Greater Element I
496. Next Greater Element IYou are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in
2017-10-19 22:35:14 165
原创 <leetcode>463. Island Perimeter
463. Island PerimeterYou are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagona
2017-10-19 18:24:23 160
原创 <LeetCode>669. Trim a Binary Search Tree
669. Trim a Binary Search TreeGiven a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to c
2017-10-18 22:28:13 197
原创 <LeetCode>566. Reshape the Matrix
566. Reshape the MatrixIn MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're given a
2017-10-17 11:06:16 180
原创 <Java>List和ArrysList的区别
今天写一道LeetCode的题的时候,遇到了List,在new的时候,IDEA的智能提示出现了很多覆盖的方法,我突然觉得奇怪,又想到之前看到的List list = new ArrayList(),就百度了一下。List类是一个接口类,它继承了 Collection 接口。List有两个重要的实现类:ArrayList 和 LinkedList。所以 List list
2017-10-16 19:31:22 261
原创 <LeetCode> 412. Fizz Buzz
412. Fizz BuzzWrite a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of
2017-10-16 19:03:28 244
原创 <LeetCode>575. Distribute Candies
575. Distribute CandiesGiven an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind.
2017-10-16 16:44:59 208
原创 <LeetCode>557. Reverse Words in a String III
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 contes
2017-10-12 20:49:53 189
原创 <LeetCode>682. Baseball Game
You're now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:Integer (one round's score): Directly represents the number of points you get
2017-10-12 20:14:57 289
原创 SQL交换一列中数据的值(如男女性别)
在刷LeetCode的时候遇到的SQL题目 627. Swap SalaryGiven a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa
2017-10-06 10:07:48 1877
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人