自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 JavaMail发送邮件中的AuthenticationFailedException异常解决

先附上代码public class JavaMail { @Test public void func() throws MessagingException { Properties prop = new Properties(); prop.setProperty("mail.host","smtp.163.com");

2018-01-11 19:04:53 22960 3

原创 Java内存模型、对象创建、对象内存布局、对象访问定位

一、内存模型运行时数据区域线程私有部分:a)        程序计数器【没有OutOfMemoryError】:当前线程所执行的字节码的行号指示器。          如果线程执行的是一个Java方法,计数器记录的是正在执行的虚拟机字节码指令的地址;若执行的是一个Native方法,这个计数器值则为空) b)        虚拟机栈【OutOfMemoryError StackO

2017-12-29 16:08:36 332

原创 合并两个排序的链表

输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。非递归形式: 链表相关的题目一定要新建一个根节点,用它的下一个结点作为处理后的链表的根节点。否则的话,若根节点为head, 每一次head = head.next;head最后会指向链表的最尾部 public ListNode Merge(ListNode list1,ListNode list2

2017-12-28 16:42:47 185

原创 513. Find Bottom Left Tree Value

问题: Given a binary tree, find the leftmost value in the last row of the tree.Example 1: Input:2/ \ 1 3Output: 1 Example 2: Input: 1 / \ 2 3 / / \4 5 6 / 7Output: 7

2017-11-05 21:30:11 356

原创 453. Minimum Moves to Equal Array Elements

问题: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1.问题分析: 对长度为n的数组每一次对n-1个元素加一,问需

2017-10-31 20:53:45 214

原创 697. Degree of an Array

问题: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length of a

2017-10-31 20:00:39 198

原创 283. Move Zeroes

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your funct

2017-10-26 21:23:38 152

原创 389. Find the Difference

问题: Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added

2017-10-20 21:48:55 225

原创 696. Count Binary Substrings

问题: Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0’s and 1’s, and all the 0’s and all the 1’s in these substrings are grouped consecutively.Substr

2017-10-19 14:53:21 1070

原创 226. Invert Binary Tree

问题: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9 to 4 / \ 7 2 / \ / \9 6 3 1问题分析:把二叉树的每个结点的左右两个子结点都进行交换,用递归进行处理。注意当两个子结点中的其中一个为空结点也要进行互换。/** * Defi

2017-10-18 18:52:12 136

原创 104. Maximum Depth of Binary Tree

问题: Given 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 node.问题说明: 查找从根结点到子结点的最多结点数,可以利用使用迭代实现DFS。/

2017-10-18 18:09:07 148

原创 695. Max Area of Island

问题: Given 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 four edges of the grid are sur

2017-10-18 15:18:13 388

原创 485. Max Consecutive Ones

问题: Given a binary array, find the maximum number of consecutive 1s in this array. 问题分析: 需要找到二进制数组中最大的连续1的数量。想到用双循环来解决这个题目,但是犯了一个需要注意的错误。class Solution { public int findMaxConsecutiveOnes(int[

2017-10-16 21:00:46 158

原创 637. Average of Levels in Binary Tree

问题 Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Input: 3 / \ 9 20 / \ 15 7 Output: [3, 14.5, 11] Explanation:

2017-10-15 20:45:14 210

原创 链表倒置

插入法 public ListNode ReverseList(ListNode head) { ListNode pre = null; ListNode next = null;//利用next来原来链表之后的内容 while(head != null){ next = head.n

2017-10-14 21:19:26 301

原创 2. Add Two Numbers

问题: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retur

2017-10-14 10:44:45 365

原创 496. Next Greater Element I

**问题:**You 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 the corresponding places of nu

2017-10-13 17:02:44 206

原创 463. Island Perimeter

问题描述:You 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 diagonally). The grid is complet

2017-10-13 13:51:35 172

原创 690. Employee Importance

690. Employee Importance**You are given a data structure of employee information, which includes the employee’s unique id, his importance value and his direct subordinates’ id. For example, employee 1

2017-10-13 10:52:16 204

空空如也

空空如也

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

TA关注的人

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