自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 剑指 Offer 42. 连续子数组的最大和

https://leetcode-cn.com/problems/lian-xu-zi-shu-zu-de-zui-da-he-lcof/solution/mian-shi-ti-42-lian-xu-zi-shu-zu-de-zui-da-he-do-2/class Solution { public int maxSubArray(int[] nums) { int res=nums[0]; for(int i=1;i<nums.length;i++){

2020-08-27 21:09:18 96

原创 剑指 Offer 68 - II. 二叉树的最近公共祖先

https://leetcode-cn.com/problems/er-cha-shu-de-zui-jin-gong-gong-zu-xian-lcof//** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */c

2020-08-05 16:59:18 192

原创 剑指 Offer 57 - II. 和为s的连续正数序列

https://leetcode-cn.com/problems/he-wei-sde-lian-xu-zheng-shu-xu-lie-lcof/集合转数组的toArray()和toArray(T[] a)方法1、ArrayList的toArray  ArrayList提供了一个将List转为数组的一个非常方便的方法toArray。toArray有两个重载的方法:  (1)list.toArray();  (2)list.toArray(T[] a);对于第一个重载方法,是将list

2020-08-05 16:28:44 303

原创 MyBatisPlus

一、简介官网:http://mp.baomidou.com/参考教程:http://mp.baomidou.com/guide/MyBatis-Plus(简称 MP)是一个 MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发、提高效率而生二、特性无侵入:只做增强不做改变,引入它不会对现有工程产生影响,如丝般顺滑损耗小:启动即会自动注入基本 CURD,性能基本无损耗,直接面向对象操作强大的 CRUD 操作:内置通用 Mapper、通用 Service,仅仅通过

2020-08-04 12:25:55 254 1

原创 剑指 Offer 58 - I. 翻转单词顺序

https://leetcode-cn.com/problems/fan-zhuan-dan-ci-shun-xu-lcof/双指针法 public String reverseWords(String s) { s = s.trim(); int j=s.length()-1,i=j; StringBuffer sb = new StringBuffer(); while (i>=0){ while (i>=0&

2020-08-03 21:10:20 62

原创 剑指 Offer 54. 二叉搜索树的第k大节点

https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof/使用ArrayList//中序遍历法 class Solution { public int kthLargest(TreeNode root, int k) { ArrayList<Integer> list = new ArrayList<>(); r(root,list);

2020-08-02 14:38:38 128

原创 剑指 Offer 15. 二进制中1的个数

https://leetcode-cn.com/problems/er-jin-zhi-zhong-1de-ge-shu-lcof/public class Solution { /*方法一 // you need to treat n as an unsigned value public int hammingWeight(int n) { int res=0; while(n!=0){ res+=n&1;

2020-07-26 14:02:41 60

原创 剑指 Offer 21. 调整数组顺序使奇数位于偶数前面

https://leetcode-cn.com/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof/class Solution { /* 双指针法 */ public int[] exchange(int[] nums) { int left=0; int right=nums.length-1; whi

2020-07-26 14:02:10 76

原创 剑指 Offer 27. 二叉树的镜像

https://leetcode-cn.com/problems/er-cha-shu-de-jing-xiang-lcof//** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution {

2020-07-26 14:01:40 66

原创 剑指 Offer 05. 替换空格

https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/class Solution { public String replaceSpace(String s) { char[] array = new char[s.length()*3]; int size=0; for(int i=0;i<s.length();i++){ char c = s.charAt(i);

2020-07-26 14:01:06 47

原创 剑指 Offer 03. 数组中重复的数字

https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/class Solution { //方法一 // public int findRepeatNumber(int[] nums) { // int[] flag = new int[nums.length]; // for(int i=0;i<nums.length;i++){ // if

2020-07-26 14:00:31 154

原创 剑指 Offer 09. 用两个栈实现队列

https://leetcode-cn.com/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/class CQueue { Stack<Integer> s1; Stack<Integer> s2; public CQueue() { s1 = new Stack<>(); s2 = new Stack<>(); } public

2020-07-26 13:58:19 204

原创 167. 两数之和 II - 输入有序数组

https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/class Solution { /*暴力破解 public int[] twoSum(int[] numbers, int target) { for(int i=0;i<numbers.length-1;i++){ for(int j=i+1;j<numbers.length;j++){

2020-07-26 13:56:29 349

原创 1. 两数之和

class Solution { /* 暴力解法 public int[] twoSum(int[] nums, int target) { for(int i=0;i<nums.length-1;i++){ for(int j=i+1;j<nums.length;j++){ if((nums[i]+nums[j])==target){ return new int[]

2020-07-26 13:54:48 66

空空如也

空空如也

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

TA关注的人

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