自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Java中String的==和isEmpty()的区别

我们首先来看下面几个示例:import java.util.*;public class Test { public static void main(String []args) { String s1 = new String(); String s2 = ""; String s3 = null; String s4; if(s1 == null) { System.out.println("s1_1"); } if(s1.isEmpty())

2021-04-20 12:22:19 244

原创 [LeetCode 1115] 交替打印FooBar

[LeetCode 1115] 交替打印FooBar我们提供一个类:class FooBar { public void foo() { for (int i = 0; i < n; i++) { print("foo"); } } public void bar() { for (int i = 0; i < n; i++) { print("bar"); } }}两个不同的线程将会共用一个 FooBar

2020-10-08 12:24:48 223

原创 [LeetCode] 51. N皇后 (java)

n皇后问题研究的是如何将 n个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。给定一个整数 n,返回所有不同的n皇后问题的解决方案。每一种解法包含一个明确的n 皇后问题的棋子放置方案,该方案中 'Q' 和 '.' 分别代表了皇后和空位。示例:输入: 4输出: [[".Q..", // 解法 1 "...Q", "Q...", "..Q."],["..Q.", // 解法 2 "Q...", "...Q", ".Q.."]]解...

2020-05-28 16:37:33 257

原创 [LeetCode] 600. Non-negative Integers without Consecutive Ones (java)

Given a positive integer n, find the number ofnon-negativeintegers less than or equal to n, whose binary representations do NOT containconsecutive ones.Example 1:Input: 5Output: 5Explanation...

2020-03-07 11:46:00 125

原创 [LeetCode] 592. Fraction Addition and Subtraction (java)

Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should beirreducible fraction. If your fin...

2020-02-27 13:22:07 156

原创 [LeetCode] 143. Reorder List

Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You maynotmodify the values in the list's nodes, only nodes itself may be changed.Example 1:Given 1->2-...

2020-01-05 19:39:57 101

原创 [LeetCode] 95. Unique Binary Search Trees II(Java)

Given an integern, generate all structurally uniqueBST's(binary search trees) that store values 1 ...n.Example:Input: 3Output:[ [1,null,3,2], [3,2,null,1], [3,1,null,null,2], [2,1,3...

2020-01-01 22:47:12 115

原创 [LeetCode] 61. Rotate List

Given a linkedlist, rotate the list to the right bykplaces, wherekis non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->3->NULLExplan...

2019-12-29 11:13:55 96

原创 [LeetCode] 57. Insert Interval(Java)

Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp...

2019-12-28 22:39:24 244

原创 太难了

生活可太难了!!!

2019-11-06 12:36:27 126 2

原创 comparison lemma

比较引理:这个定理大意就是: 两个函数 f1, f2. f1的起始点的函数值小于等于f2, 而且f1的导数还永远小于等于f2, 所以必然f1的函数值一直小于等于f2定理截图:证明:参考文献:H. Khalil, Nonlinear Systems, 2nd ed....

2019-10-31 11:53:54 2093 1

原创 support function(支撑函数)

待写

2019-10-24 10:06:02 3308

原创 要写

open ball椭球体突多面体

2019-10-16 17:54:19 94

原创 compact set(紧集)、close set(闭集)、open set(开集)

open set:(开集):实数空间R中的开区间都是开集(a,b) 空集是开集 实数空间R中的无限开区间 半开半闭区间、无限闭区间都不是R中的开集 (a,b], ...

2019-10-16 17:39:54 7490 2

原创 [LeetCode] 1116. Print Zero Even Odd

Suppose you are given the following code:class ZeroEvenOdd { public ZeroEvenOdd(int n) { ... } // constructor public void zero(printNumber) { ... } // only output 0's public void even(p...

2019-09-12 17:58:11 554

原创 [LeetCode] 1115. Print FooBar Alternately

Suppose you are given the following code:class FooBar { public void foo() { for (int i = 0; i < n; i++) { print("foo"); } } public void bar() { for (int i = 0; i < n;...

2019-09-11 12:03:24 362

原创 [LeetCode] 1114. Print in Order

利用volatile关键字方法关于volatile关键字的解析可查看:https://blog.csdn.net/liuwenyou/article/details/100690719private volatile boolean firstflag,secondflag; public Foo() { } public void first...

2019-09-10 10:55:28 207

原创 java volatile 关键字

定义:volatile关键是声明的变量表示有其他线程可能会更改该变量的值,所以各线程对于volatile定义的变量必须从主存中获取,而不能通过缓存中获取,但是volatile字段是非阻塞的,即无锁的,也就是说,它只保证每次从主存中获取数据,但是不能让read-update-write过程是成为一个原子操作,这也是它和Synchronized关键字的一个重要区别。实例:public ...

2019-09-10 10:35:38 125

原创 [LeetCode] 264. Ugly Number II

Write a program to find then-th ugly number.Ugly numbers arepositive numberswhose prime factors only include2, 3, 5.Example:Input: n = 10Output: 12Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 10...

2019-09-07 21:02:39 112

原创 [LeetCode] 263. Ugly Number

Write a program to check whether a given number is an ugly number.Ugly numbers arepositive numberswhose prime factors only include2, 3, 5.Example 1:Input: 6Output: trueExplanation: 6 = 2 ×...

2019-09-07 20:14:03 118

原创 Prime(素数)判定 (java)

素数定义:大于1,且只有1和它本身两个因数,即不能写成n=p*q(p、q均不为1)判定算法:方法一:根据定义从2到n-1,依次判断n是否能整除,如果都不能则为素数 private boolean isPrime(int m){ for(int i=2;i<m;i++){ if(m%i==0){ retur...

2019-09-07 17:56:32 1554 1

原创 PriorityQueue详解

优先级队列是基于优先级堆的,优先级队列的元素是基于它们的自然顺序有序排列的。不允许有空元素,默认为最小堆。声明定义:PriorityQueue<T> pq=new PriorityQueue<T>();从小到达排序PriorityQueue<T> pq=new PriorityQueue<T>(Collections.reverse())...

2019-09-04 11:26:16 209

原创 [LeetCode] 239. Sliding Window Maximum

239.Sliding Window MaximumGiven an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Ea...

2019-09-04 10:35:58 103

原创 java String类方法总结

1、获取字符串长度:length()2、获取字符串第i个位置的字符:charAt(i)3、获取指定字符或者字符串的位置:indexOf(ch)返回的是第一次出现位置的索引 无指定字符或字符串返回-1indexOf(ch,fromIndex)返回fromIndex之前第一次出现的位置索引lastIndexOf(ch)返回的是最后一次出现的位置索引lastIndexOd(...

2019-08-28 10:23:15 182

原创 IDEA导入eclipse项目,setattribute方法报错cannot resolve mtthod 'setAttributes'

idea导入eclipse项目,setAttribute方法以及out.printfan方法报错,因缺少servlet-api.jar和jsp.jar包(tomcate自带这两个jar包),打开module settings,在library里添加tomcate文件lib下的这两个jar包即可。...

2018-04-23 16:22:14 1017

原创 jsp从数据库读取数据显示到jsp页面

整个项目结构,jar包可网上下载导入package com.Podcast.dbutil;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;im...

2018-04-17 10:38:06 63015 8

空空如也

空空如也

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

TA关注的人

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