- 博客(15)
- 问答 (1)
- 收藏
- 关注
原创 剑指offer 3:二维数组中的查找
package offer;/** * 面试题3:二维数组中的查找 * 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。 * 输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 * * @auther Dennis * @date 2017/12/15 * 思想:假设需要查找的数字为x,首先选取数组中右上角的数字。如果该数字等...
2017-12-19 14:39:50 321
原创 eclipse从mybatis接口直接跳转到xml的插件
MyBatipse 这个插件ctrl+左键点击mapper的方法最后一个就是可以跳转到xml,虽然没有idea好用但是公司如果不允许用收费的软件还是只能有eclipse了在eclipse的市场搜索,安装,重启Eclipse后。就可以从 xxxmaper.java 跳转到对应的 xxx.xml。
2017-12-15 17:58:23 9193
原创 git第一次提交代码至远程仓库步骤
可以打开Idea 的 terminal直接进行命令操作1、git init2、git add src(这个src意思是添加src目录下的所有文件,有些会说add .. 那就是提交工程下的所有文件,在这我只拿src目录说明,这个时候如果输入 git status 就可以看到要提交的文件变成了黄色,前面还有一个new file)3、git commit -am "first comm
2017-12-15 14:32:29 29376 2
原创 构造方法及例题
构造方法是用来初始化对象的方法,与类名相同,无返回值1、没有指定构造方法,系统自动加无参构造方法2、指定了构造方法,系统不会再自动添加一个对象建立,构造方法只运行一次,一般方法可以被对象调用多次。构造方法能被重载,不能被继承,所以不能重写class Base{ public Base(String s){ System.out.print("B");...
2017-12-15 09:20:42 697
原创 LeetCode【122】Best Time to Buy and Sell Stock II
/** * 题意:和121题不同的地方是可以多次买卖任意次,然后求多次买卖后最大利润 * * @auther Dennis * @date 2017/12/13 * 思想:贪心思想,最大的收益方法就是尽可能多的低入高抛,只要明天比今天价格高,就今天买,明天卖 */public class BestTimetoBuyandSellStockII { public static
2017-12-13 10:10:42 455
原创 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 stock),
2017-12-13 09:57:49 310
原创 LeetCode【88】 Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold add
2017-12-12 20:07:45 258
原创 java用post方法获取json数据,与服务器进行交互
首先下载相关的依赖包:https://jingyan.baidu.com/article/eae07827abc6b41fec5485c3.html下载好以后导入依赖包,下面sendInfo方法就是交互方法,可以直接拿去用:public static String sendInfo(String sendurl, String data) { Closeabl
2017-12-11 19:59:31 3085
原创 org.apache.commons.lang.exception.NestableRuntimeException的解决方法
今天在转json的时候遇到上面这个异常,就是jar包没有完全导入,导入下面的jar包以后6个包以后就不存在问题了,找到了一个可以直接下载的链接:下载文件地址:https://files.cnblogs.com/files/xiandedanteng/json-lib-2.4%26dependencies_jars.rarcommons-beanutils-1.9.3.jarco
2017-12-11 19:17:57 484
原创 LeetCode【66】 Plus One
/** * 给一个数组(首位不为0)加上一个数,返回这个素数组 * 思想:需要考虑进位,如果加到数组第一个元素还需要进位则需要在第一个位置也就是a[0]位置加上1 */public static int[] plusOne(int[] nums) { int n = nums.length; for (int i = n - 1; i >= 0; i--) { if
2017-12-11 15:19:07 275
原创 java读取写入csv文件Demo
读取Demo:public static void main(String[] args) { File csv = new File("C:\\Result.csv"); // CSV文件路径 BufferedReader br = null; try { br = new BufferedReader(new FileReader(csv)...
2017-12-05 19:40:28 6021
原创 Switch用String做参数
网上查了说switch只能用 byte、short、char、int 做值,那是jdk1.7之前,在1.7之后就可以了,其实jdk1.7中并没有新的指令来处理switch string,而是通过调用switch中string.hashCode,将string转换为int从而进行判断。下面例子稍微看一下就可以运用在实际开发中了。switch ("123") { case "1
2017-12-04 20:11:27 379
原创 LeetCode【53】Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1]
2017-12-04 17:00:03 279
原创 LeetCode【35】Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array....
2017-12-04 13:14:13 227
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人