自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 剑指offer 数值的整数次方

题目描述给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。保证base和exponent不同时为0public class Solution { public double Power(double base, int exponent) { if(exponent<0) { ...

2019-09-09 23:34:16 120

原创 剑指offer 二进制中1的个数

题目描述输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。public class Solution { public int NumberOf1(int n) { int count = 0; while(n!= 0){ count++; n = n & (n - 1); ...

2019-09-05 23:36:31 99

原创 剑指offer 矩形覆盖

题目描述我们可以用21的小矩形横着或者竖着去覆盖更大的矩形。请问用n个21的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?public class Solution { public int RectCover(int target) { if(target==0) return 0; if(target==1) return 1; ...

2019-09-05 23:28:30 98

原创 剑指offer 变态跳台阶

题目描述一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。public class Solution { public int JumpFloorII(int target) { if(target==1) return 1; return 2*JumpFloorII(target-1); ...

2019-09-05 00:06:44 76

原创 剑指offer 斐波那契数列

题目描述大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0)。n<=39public class Solution { public int Fibonacci(int n) { if(n==0) return 0; if(n==1) return 1; return Fibonac...

2019-08-27 23:36:01 110

原创 剑指offer 旋转数组的最小数字

题目描述把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素。例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。import java.util.ArrayList;public class Solution { ...

2019-08-27 23:29:31 69

原创 剑指offer 用两个栈实现队列

题目描述用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。import java.util.Stack;public class Solution { Stack<Integer> stack1 = new Stack<Integer>(); Stack<Integer> stack2 = new Sta...

2019-08-21 23:46:22 68

原创 剑指offer 重建二叉树

题目描述输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。/** * Definition for binary tree * public class TreeNode { * int val;...

2019-08-21 00:05:06 61

原创 剑指offer从尾到头打印链表

/*** public class ListNode {* int val;* ListNode next = null;** ListNode(int val) {* this.val = val;* }* }**/import java.util.ArrayList;import ...

2019-08-18 18:12:44 67

原创 剑指offer 替换空格

请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。public class Solution { public String replaceSpace(StringBuffer str) { return str.toString().replace(" ","%20")...

2019-08-18 17:28:39 117

原创 剑指offer二维数组中的查找

在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。public class Solution { public boolean Find(int target, int [][] array) { int chang = array...

2019-08-18 16:54:02 66

原创 Leetcode3 Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Input: ...

2019-08-18 16:32:40 63

原创 Leetcode 2 Add two numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i...

2019-08-14 22:31:01 81

原创 Leetcode 1 two-sum

class Solution { public int[] twoSum(int[] nums, int target) { Map<Integer,Integer> map =new HashMap<Integer,Integer>(); for(int i=0;i<nums.length;i++) { ...

2019-08-11 16:32:57 59

原创 Thymeleaf循环时 带上序号

使用Thymeleaf循环列表时,有时候需要在前端显示出序号,这时可以使用thymeleaf 循环的状态变量。&lt;tr th:each="service:${services}" &gt; &lt;td th:text="${serviceStat.index+1}"&gt;&lt;/td&gt; &lt;td th:text="${service.name...

2018-11-29 15:47:05 12151 1

原创 SpringBoot 开启 Mybatis 日志

SpringBoot 开启 Mybatis 日志在properties新增:logging.level.org.sysu.rain.Mapper=debug注意:其中org.sysu.rain是Mapper包位置等号后面是日志等级。

2018-11-29 15:30:53 7255 1

空空如也

空空如也

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

TA关注的人

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