自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 416. Partition Equal Subset Sum

416. Partition Equal Subset Sum题目:假设一个非空数组中仅包含正整数,判断是否可以将该数组分为两个子数组,使得两个子数组中元素的和相等题解:这是一个0-1背包问题,假设原数组的和为sum,问题可以转化为:找到一个原数组的子集,使其子集内的元素之和等于sum/2。方案一:递归算法假设原数组为nums,其中有n个数,其和为sum,那么需要在这n个数中找出一个子集使...

2019-04-24 20:11:14 219

原创 Spring bean的生命周期

Spring对bean进行实例化。 spring将值和bean的引用注入到bean对应的属性中。 如果bean实现了BeanNameAware接口,Spring将bean的ID传递给setBeanName()方法。 如果bean实现了BeanFactoryAware几口,Spring将调用setBeanFactory()方法,将BeanFactory 容器示例传入。 如果bean实现了Ap...

2019-01-08 15:21:07 194

原创 2018网易互娱秋招笔试题

1. 计算税import java.util.Scanner;public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); ...

2018-08-09 22:08:53 2813

原创 synchronized同步三种使用方法

1.同步代码块synchronized (对象){ //代码块}上面的对象可以是任意对象,但必须为同一对象2.同步函数synchronized void method(){ //代码}同步方法使用的同步对象为该方法所属类本身,即this3.同步静态方法synchronized static void method(){ //代码}

2017-12-22 16:58:46 1667

原创 389. Find the Difference

Q: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

2016-11-29 20:43:47 238

原创 283. Move Zeroes

Q: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

2016-11-27 13:05:42 319

原创 387. First Unique Character in a String

Q:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.问题:给定一个字符串,找出其中第一个仅出现一次的字符,若不存在返回-1。Examples:s = "leetcode"return 0.

2016-11-27 11:24:11 326

原创 258. Add Digits

Q:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has

2016-11-27 10:18:05 253 1

原创 136. Single Number

Q:Given an array of integers, every element appears twice except for one. Find that single one.问题:给定一个整数数组,其中除了一个元素仅出现一次,其他每个元素出现了两次。找到这个仅出现一次的数。思路:用异或符“^” ,“^”可以理解为将二进制数的对应位相加且无进位,将数组中所有数依次亦或后,

2016-11-26 21:41:54 294

空空如也

空空如也

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

TA关注的人

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