自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 问答 (2)
  • 收藏
  • 关注

原创 *leetcode刷题_(剑指offer_滑动窗口)_57_和为s的连续数列/和为s的两个数字

面试题57. 和为s的两个数字 输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它们的和正好是s。如果有多对数字的和等于s,则输出任意一对即可。 示例 1: 输入:nums = [2,7,11,15], target = 9 输出:[2,7] 或者 [7,2] 示例 2: 输入:nums = [10,26,30,31,47,60], target = 40 输出:[10,30] 或者 ...

2020-02-27 17:22:21 138

原创 leetcode刷题_(剑指offer_归并排序)_51寻找逆序对

面试题51. 数组中的逆序对 在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数。 示例 1: 输入: [7,5,6,4] 输出: 5 限制: 0 <= 数组长度 <= 50000 解答: 根据之前的经验可知 此题使用归并排序解答。 1 归并使用双封闭的二分[ l ,m ] [ m+1 , r ],即能取到...

2020-02-25 05:00:42 169

原创 javase_day9_浅显认识概念(JVM, error, concurrency, web)

关于垃圾回收的一些概念问题: C艹 一般来说允许开发者对对象的生命周期以及存储空间进行设计 对于java来说:在 堆 (heap) 的动态池内动态地创建对象(需要即创建) 垃圾回收应运而生:自动发现对象何时不再被使用,继而销毁。 基于 1 所有对象都是继承自 object 2 只能以一种方式创建对象(动态地在堆上创建) 异常处理: 异常 是一种 对象! 1 从出错地点被抛出 2 被专门用来处理特...

2020-02-20 21:19:05 95

原创 leetcode刷题(剑指offer)_(二叉堆)_40最小的k个数字

面试题40. 最小的k个数 输入整数数组 arr ,找出其中最小的 k 个数。例如,输入4、5、1、6、2、7、3、8这8个数字,则最小的4个数字是1、2、3、4。 示例 1: 输入:arr = [3,2,1], k = 2 输出:[1,2] 或者 [2,1] 示例 2: 输入:arr = [0,1,2,1], k = 1 输出:[0] 解答: 这是一道简单题。 最简单的做法是先sort,再取前k...

2020-02-20 20:36:52 313

原创 javase_day8_generics(泛型)

泛型提供了编译时类型安全检测机制,该机制允许程序员在编译时检测到非法的类型。泛型的本质是参数化类型,也就是说所操作的数据类型被指定为一个参数。 ...

2020-02-18 22:31:17 118

原创 leetcode刷题_(剑指offer_双指针)_21奇偶排列

输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数位于数组的前半部分,所有偶数位于数组的后半部分。 示例: 输入:nums = [1,2,3,4] 输出:[1,3,2,4] 注:[3,1,2,4] 也是正确的答案之一。 提示: 1 <= nums.length <= 50000 1 <= nums[i] <= 10000 来源:力扣(LeetCode) 链...

2020-02-16 19:08:39 130

原创 ***leetcode刷题_(剑指offer_11_二分法/ 53_二分查找排序数组中的数字)

code11: 旋转数组的最小值 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个递增排序的数组的一个旋转,输出旋转数组的最小元素。例如,数组 [3,4,5,1,2] 为 [1,2,3,4,5] 的一个旋转,该数组的最小值为1。 示例 1: 输入:[3,4,5,1,2] 输出:1 示例 2: 输入:[2,2,2,0,1] 输出:0 来源:力扣(LeetCode) 链接:h...

2020-02-15 19:40:20 144

原创 leetcode刷题_(sort,LinkedList)_code148(链表排序)

code148: Sort List Add to List Share Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5...

2020-02-13 21:05:23 133

原创 *leetcode刷题_(DP,recursion,tree)_code124(树的最大值path)_code136_(分裂单词)

code124: Binary Tree Maximum Path Sum non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree alo...

2020-02-10 18:09:10 296

原创 *leetcode刷题(剑指offer9)_(DP)_斐波那契数列

斐波那契数列 本身就是一个递归的过程(动态规划的问题) 如果求第n个数时,返回的参数是n-1以及n-2。 普通的递归写法: def count(self,n):#when we use recursion, we may use one result too many times, which leads to a high complexity if n ==0: ...

2020-02-09 21:50:06 81

原创 **leetcode刷题_(DP,backtraking)_code1155(掷骰子)

CODE1155:Number of Dice Rolls With Target Sum You have d dice, and each die has f faces numbered 1, 2, …, f. Return the number of possible ways (out of fd total ways) modulo 10^9 + 7 to roll the dice ...

2020-02-09 21:03:24 2153

原创 python_链表实现以及其各种方法

# #需要搞清楚,node对象属性类的关系!!!!!!!!!!!!!!?????????? # class Node: def __init__(self,value=None,next=None): self.value = value ###value connects to definite value self.next = next ### nex...

2020-02-09 18:25:22 315

原创 python_树的构造_以及各种遍历方法

构造树: class TreeNode: def __init__(self,val): self.val = val self.left = None self.right = None def print_all(self): if self: print(self.val) ...

2020-02-09 18:23:23 220

原创 *leetcode刷题_(math,KA,改变思路)_code121(卖袜子)

code121: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 (i.e., bu...

2020-02-07 21:11:29 192

原创 leetcode刷题_(arr,dfs,balanced binary tree)_code105(判断是否为平衡二叉树)

code110:Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the left and right subtrees ...

2020-02-05 23:01:54 183

原创 ***leetcode刷题_(arr,dfs)_code79(单词寻找)

code79:Word Search Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontal...

2020-02-04 20:01:02 141

原创 ***leetcode刷题_(quicksort,dutch partition problem)_code75(颜色分类)

code75: Sort Colors an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we wi...

2020-02-03 20:40:48 160

原创 leetcode刷题(剑指offer)_(linkedlist)_根据中序遍历以及前序遍历显示完整链表/BST的后序遍历

解答: 前序遍历:中左右 中序遍历:左中右 后序遍历:中右左 根据 前序 可以确定root,然后在中序中可以找到 左右 子树范围。 进一步递归即可找到所有点。 代码: class Node: def __init__(self,value): self.value = value self.left = None self.right = ...

2020-02-01 21:17:00 191

空空如也

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

TA关注的人

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