- 博客(14)
- 问答 (1)
- 收藏
- 关注
原创 编程之美:一摞烙饼的排序 pancake sorting
编程之美 1.3:给定一个数组nums,每次只能翻转0-i之间的数字,求把nums排好序的最小翻转次数主要思想:利用DFS遍历出所有可能结果,从中找出翻转次数最小的一种import java.util.Arrays;//编程之美 1.3:给定一个数组nums,每次只能翻转0-i之间的数字,求把nums排好序的最小翻转次数//主要思想:利用DFS遍历出所有可能结果,从中找出翻转次...
2019-05-22 16:37:54
414
原创 把数组排成最小的数
题目描述输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。例如输入数组{3,32,321},则打印出这三个数字能排成的最小数字为321323。import java.util.*;public class 把数组排成最小的数 { public static void main(String[] args) { int[] test = {...
2018-10-24 15:17:50
146
原创 Python || ImportError: No module named 'XXX'
同一目录下的,a.py b.py当在a.py中引用b.py时,直接在a.py中import b报错:ImportError: No module named 'b' 解决办法:import syssys.path.append('b的绝对路径')import b ...
2018-09-09 10:46:16
184
原创 杨辉三角问题 Java和Python实现
杨辉三角Java实现:public class YanghuiTriangle { public static void main(String[] args) { triangle(6); } public static void triangle(int lines) { int t[][]=new int[lines][]; t[0]=new int[1
2017-09-23 09:27:08
283
原创 汉诺塔问题 Python实现
学习Python的第二天,贴个Python实现的汉诺塔问题的代码吧~i=0def move(n, a, b, c): if n == 1: global i #函数里要想引用全局变量,前面加global关键字 i+=1 print('move', a, '-->', c) #只有一个盘子是直接将初塔上的盘子移动到目的地 el
2017-09-19 21:19:06
390
原创 Construct String from Binary Tree(tag:String)
You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.The null node needs to be represented by empty parenthesis pair "()". And yo
2017-07-08 21:09:00
225
原创 Reverse String I、II、III(tag:String)
Reverse String I:Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Solution1(最开始自己的思路,效率较低):public static Stri
2017-07-06 20:33:58
264
原创 Count and Say(tag:String)
Qustion:The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.
2017-07-05 19:20:38
302
原创 Java关键字assert
static void sort(Object[] a, int lo, int hi, Object[] work, int workBase, int workLen){ assert a != null && lo >= 0 && lo <= hi && hi <= a.length; .......}
2016-12-10 11:04:34
358
原创 目录
MyBlog-JAX-WS Web Services-Deployment Descriptor-Java Resorces -src/main/java -com.lwp.myblog -action -BlogEditAction.java -UserAction.java -dao -BlogMapper.java -UserM
2016-10-12 09:06:45
265
原创 个人博客MyBlog
MyBlog-JAX-WS Web Services-Deployment Descriptor:MyBlog-Java Resorces -JavaScrip Resources-Deployed Resources-src-target-pom.xml
2016-10-11 16:29:37
604
原创 判断String是否为空
关于判断String是否为空,规范一下写法,养成好习惯。自己之前的写法:if(str.equals("")){System.out.print("str为空");}经师傅提醒,规范写法应该如下:if(StringUtils.isBlank(str)){System.out.print("str为空");}总结:StringUtils.isBlan
2016-09-12 15:49:32
554
原创 解决java.lang.NullPointerException
java.lang.NullPointerException为空指针异常。这种异常一般发生在要求使用“对象”的时候使用了null,例如调用null对象的方法,属性等。例:String str=null;str.equals("abc");//会抛异常总结自前几日的一个bug修复:前端AJAX传给action的参数少了一个,action里将这个以为获得了的参数传给了其他serv
2016-08-29 11:01:23
1262
原创 读取properties文件中属性值并显示到前端页面
本文将实现把系统版本信息存储在properties配置文件中,然后在前端页面可点击版本图标获取版本信息。version.properties:#SVN版本SVNVersion = 211937#版本日期VersionDate = 2016-08#平台版本号PlatformVersion = V2.3.5VersionAction.java:
2016-08-23 18:42:14
6763
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人