自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(24)
  • 资源 (1)
  • 收藏
  • 关注

原创 793. Preimage Size of Factorial Zeroes Function題解

原題描述如下:Let f(x) be the number of zeroes at the end of x!. (Recall that x! = 1 * 2 * 3 * ... * x, and by convention, 0! = 1.)For example, f(3) = 0 because 3! = 6 has no zeroes at the end,

2018-03-08 10:16:34 267

原创 几道有意思的多线程作业题

原作业链接地址 今天先写第二题,如下: Reverse hello Write a program called ReverseHello.java that creates a thread (let’s call it Thread 1). Thread 1 creates another thread (Thread 2); Thread 2 creates Thread 3

2018-01-30 00:07:55 1442

原创 今日头条笔试题,任务调度问题

产品经理(PM)有很多好的idea,而这些idea需要程序员实现。现在有N个PM,在某个时间会想出一个 idea,每个 idea 有提出时间、所需时间和优先等级。对于一个PM来说,最想实现的idea首先考虑优先等级高的,相同的情况下优先所需时间最小的,还相同的情况下选择最早想出的,没有 PM 会在同一时刻提出两个 idea。同时有M个程序员,每个程序员空闲的时候就会查看每个PM尚未执行并且

2018-01-27 20:01:31 8381

原创 解析一个数组JsonArray下有多种数据类型JsonObject的Json

使用com.google.gson.Gson,解析一个数组JsonArray下有多种数据类型JsonObject的Json

2018-01-25 11:54:23 6173

原创 java 三个线程依次输出abc

题目描述:启动三个线程,线程1打印a,线程2打印b,线程3打印c,依次打印15次。Lock Condition实现代码如下:public class NAbcPrinter { private final Lock lock = new ReentrantLock(); private final Condition con1 = lock.newCondition

2018-01-21 23:28:18 2343

原创 java3个线程轮流输出1,2,3,4,5...75

原题描述启动3个线程打印递增的数字, 线程1先打印1,2,3,4,5, 然后是线程2打印6,7,8,9,10, 然后是线程3打印11,12,13,14,15. 接着再由线程1打印16,17,18,19,20….以此类推, 直到打印到75. 其实这里可以在每个线程中直接循环5次控制输出的结束,但是很多人对中断并不是很熟悉,所以我写成了中断的形式,希望可以加深对中断的理解。而且

2018-01-18 17:17:47 3170

原创 LeetCode 题解:315. Count of Smaller Numbers After Self

原题如下:You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].

2018-01-17 12:27:49 783

原创 两个有序数组中,找第K个数

public int findKthNum(int[] nums1, int[] nums2, int k) { if (k > ((nums1 == null) ? 0 : nums1.length) + ((nums2 == null) ? 0 : nums2.length) || k <= 0) return Integer.MIN_VALUE;

2018-01-10 14:47:32 1978 2

原创 java8 之一行代码解决

java 8 一行代码 最大 最小

2017-12-25 22:55:26 332

原创 LeetCode 题解: 714. Best Time to Buy and Sell Stock with Transaction Fee

You are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as

2017-12-10 19:30:16 479

原创 文章标题

1:自增赋值的理解 public static void main(String[] args) { int count = 0; for (int i = 0; i < 10; i++) { count = count++; } System.out.println(count); }上述的程序最

2017-12-10 19:16:38 113

原创 LeetCode题解:309. Best Time to Buy and Sell Stock with Cooldown

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy

2017-12-10 18:07:30 149

原创 LeetCode题解:188. Best Time to Buy and Sell Stock IV

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most k transactions.Note:You may no

2017-12-10 17:31:57 189

原创 LeetCode题解: 122. Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one

2017-12-10 16:19:22 165

原创 LeetCode题解:123. Best Time to Buy and Sell Stock III

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You may no

2017-12-10 15:38:11 296

原创 LeetCode题解:121. Best Time to Buy and Sell Stock

原题地址Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the

2017-12-10 14:20:34 144

原创 两个Docker容器之间创建一个点对点的连接

最近在跟着docker_practice 学docker,看到网络部分的创建容器之间点对点的连接示例时。很多命令不知所云(之前没怎么学过linux的网络配置),现在对其中的命令和步骤,逐一进行讲解。示例:创建一个点到点连接 默认情况下,Docker 会将所有容器连接到由 docker0 提供的虚拟子网中。 用户有时候需要两个容器之间可以直连通信,而不用通过主机网桥进行桥接。 解决办法很简单:创

2017-11-17 17:35:46 1478 1

转载 ubuntu 下出现E: Sub-process /usr/bin/dpkg returned an error code

转载 http://blog.csdn.net/yusiguyuan/article/details/24269129在用apt-get安装软件时出现了类似于 install-info: No dir file specified; try –help for more information.dpkg:处理 gettext (–configure)时出错: 子进程 post-installat

2017-11-14 14:34:10 309

原创 Hibernate多对多数据插入时 stackoverflow Error

在多对多关系的维护中,插入一条数据。学生和课程多对多关系中,由学生来维护关联表,现在学生新选一门课,需要在学生的Bean中的courses属性 中加入一个课程,在这个过程中报StackOverFlowError。分析原因是没有重写Course的Hashcode和equals方法导致的。特此记录一下。Set<Course> courses org.springframework.web.util

2017-11-09 11:59:33 398

原创 Java List.toArray 问题

public static void main(String[] args) { List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 4)); Integer[] arr = list.toArray(); }Incompatible types. Required: java.lang.In

2017-10-20 17:32:27 709

原创 Hibernate环境搭建以及测试(maven)

今天跟着黑马程序员的视频学习了一下Hibernate,试着自己搭建了环境,真是踩了很多坑,记录一下。mysql的下载和安装环境:windows64位 1.选择安装版本的会好一些,免安装版本的会有很多的配置,会很麻烦。下载安装版的mysql,不管你的系统是64还是32位的,下载32的即可 2.一开始选择的是Developer Default,但是总是安装到一半就出错,后来选择full还是一半就出错

2017-08-25 10:18:14 312

原创 java多线程通信,实现特定字符串的输出

实现多线程通信输出 1 2 A 3 4 B 5 6 C 7 8 D 9 10 E 11 12 F 13 14 G 15 16 H 17 18 I 19 20 J 21 22 K 23 24 L 25 26 M 27 28 N 29 30 O 31 32 P 33 34 Q 35 36 R 37 38 S 39 40 T 41 42 U 43 44 V 45

2017-07-09 13:29:22 492

原创 java运算符,>>,>>>,<<

>>:有符号右移>>>:无符号右移>>:有符号右移,就是把int值在内存中的补码,整体向右移动,空出来的位补符号位。>>>:无符号右移,就是把int值在内存中的补码,整体向右移动,空出来的位补0。int类型的数据,在内存中是按照补码的形式存放的。右移的时候,先把这32位的补码,整体先移动相应的位数。如果是>>,则因为移动空出来的位,就补上符号位(即32位补码中的最高位)。如果是

2017-07-06 23:01:23 272

原创 java通过时间戳获得时间字符串

String timeStr = new SimpleDateFormat(“yyyy-MM-dd”).format(new Date(historyTime*1000)); 这里的时间戳是秒数,需要乘以1000,转化成毫秒数。

2016-11-26 12:38:56 1611

VHDL PPT学习文档

VHDL学习文档,PPT。入门教程

2016-04-06

空空如也

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

TA关注的人

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