10 2017 档案
摘要:226. Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This prob...
阅读全文
摘要: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 ...
阅读全文
摘要: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 (hori...
阅读全文
摘要: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: 3Explanat...
阅读全文
摘要:693. Binary Number with Alternating BitsGiven a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have...
阅读全文
摘要:690. Employee ImportanceYou are given a data structure of employee information, which includes the employee's unique id, his importance value and his ...
阅读全文
摘要: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.Exampl...
阅读全文
摘要:1.异常分类异常的对象都是派生于Throwable类的一个实例。在throwable的下一层,立即分解为两个分支:Error,ExceptionError类层次结构描述了Java运行时系统的内部错误和资源耗尽错误。应用程序不应该抛出这种类型的对象。这种情况很少出现。Exception层次又分解为两个...
阅读全文
摘要: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 l...
阅读全文
摘要:现在的github desktop的网页好像被q了,这里给出离线下载地址:github desktop离线下载这里是CSDN资源地址:CSDN资源下载(截止17.10.21还是可以下载的)1.下载完成后,点击打开2.打开后,会在当前目录生成如下目录:3.把此目录移动到你想安装的目录,打开目录,点击s...
阅读全文
摘要:在编写Java程序的时候,有时要添加别人的jar,以下就是步骤:1.在打开你的project的情况下,点击File,选择Project Structure2.选择Modules,选择Dependencies,再选择+,找到你要填加的jar包就可以了
阅读全文
摘要:上课时只听老师说过,Java取余的操作的符号位是和被除数一致的,但不知道为啥例如:-14%3 余数是 -214%-3 余数是 2后来才知道,对余数的定义是 (a/b)*b + a%b 恒等于 a这样的话,-14/3*3的结果是-4*3 = -12,所以余数是-2;14%3同理啦
阅读全文
摘要:编写递归时,最重要的有以下三点:递归总有一个最简单的情况——方法的第一条语句总是包含一个return的条件语句递归调用总是尝试解决一个规模更小的子问题,这样递归才能收敛到最简单的情况。递归调用的父问题和尝试解决的子问题之间不应该有交集。违背以上原则写出的代码可能是错误的或者低效的。
阅读全文
摘要: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 overla...
阅读全文
摘要: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...
阅读全文
摘要: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 conn...
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要:今天写一道LeetCode的题的时候,遇到了List,在new的时候,IDEA的智能提示出现了很多覆盖的方法,我突然觉得奇怪,又想到之前看到的List list = new ArrayList(),就百度了一下。List类是一个接口类,它继承了 Collection 接口。List有两个重要的实现类...
阅读全文
摘要: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...
阅读全文
摘要:575. Distribute CandiesGiven an integer array with even length, where different numbers in this array represent different kinds of candies. Each numbe...
阅读全文
摘要: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.Ex...
阅读全文
摘要: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): Direct...
阅读全文
摘要:在刷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.,...
阅读全文