自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 排序算法总结

排序算法总结总结总结稳定排序:相同值元素排序之后前后相对顺序不变1、不稳定排序:选择排序,希尔排序,快速排序,堆排序 快选希堆2、稳定排序:插入排序,冒泡排序,归并排序,计数排序 插冒归计原地排序:直接在原数组上进行,不申请额外数组空间非原地排序:归并排序十大排序算法1、选插冒 O(n*n)(1) 选择排序:(有序区,无序区); 在无序区中选择最小元素与无序区首元素交换; 无序区最小元素归位; 不稳定、原地排序(2) 冒泡排序

2021-09-01 10:25:13 178

原创 最大化最小值/ 最小化最大值问题

最大化最小值/ 最小化最大值问题基本题型: 给定n个整数序列,将其划分为m个连续子序列,求这m个子序列的和的最大化最小值 或者最小化最大值问题。解题思路: 二分法具体过程:根据题意,确定二分的上界与下界(一般为子序列和的可能取值、元素差值等)(有利于加快速度)确定二分中的分块条件,根据该条件与当前界限,对数组进行分块根据当前二分的块数调整上下界// leetcode 410. 分割数组的最大值// 题意:将数组分成m个非空连续子数组,使得这m个子数组各自和的最大值最小 ==== 最小化

2020-09-25 19:40:39 2540 1

原创 Python爬虫 重定向+Http2协议

爬虫程序中链接A点开出错,而浏览器中打开链接发生了重定向,F12编辑查看发现存在302重定向,且request headers里面存在http2协议头::authority,:method, :path, :scheme,且这四个字段为必须字段。https://www.jianshu.com/p/1335a518151f 中提出使用 from hyper.contrib import HTTP20Adapter 经测试无效;https://stackoverflow.com/questions/462

2020-08-31 21:55:37 1296 3

原创 回溯+剪枝+去重 LeetCode : 39组合总和;LeetCode 40组合总和II; LeetCode 46 全排列;LeetCode 47全排列 II

数组取元素搞排列:递归、回溯、剪枝想象一棵树,树中不同层次、不同节点即代表了当前选择的不同状态。dfs遍历该树,根据题目条件进行剪枝回溯,找出所有满足结果即可。取全部元素:使用标记数组,每次都需要判断每个元素是否可用;取部分元素:可按照顺序(数组下标)取满足条件的一部分数据,判断是否可用;数组相关解集无重复问题:一般需要首先对数组进行排序,遍历数组时考虑nums[i]=nums[i+1]这样某一区间元素相等的情况,大多都只需要对第一个或最后一个元素进行处理,而其他的跳过。结果集无重复:想

2020-08-16 11:37:22 147

原创 Java 栈、队列、映射、集合

本篇文章只是本人为方便查找相关方法而记录,下面具体代码并没有真正运行。 ***(一) 栈: 先进后出数据结构,只能在一端进行插入与删除*** // 继承自Vector,底层通过数组实现, List接口有的方法都有,即许多方法与前面ArrayList相同,这里不再列出 // (1) 创建栈 只有一个无参构造方法 Stack<String> st=new Stack<String>(); Stack<Stri

2020-08-15 17:52:17 147

原创 ArrayList, LinkedList, Collections

数组在开辟时需要指定数组元素的个数,且个数一旦确定,不能随意更改. 链表类似于数组,但是可以动态的增加或减少元素。 // (一)、LinkedList 利用-双向-链表实现,增删方便,查询慢 // (1) LinkedList的创建: 不带参(空集合) / 带参(由已有集合转化) LinkedList<Integer> lis = new LinkedList<>(); List<Integer> lis2=new

2020-08-14 22:29:43 111

原创 Math类、BigInteger大数类

***(一)Math数学工具类*** System.out.println("Math.E = " + Math.E); // 指数 System.out.println("Math.PI = " + Math.PI); // 圆周率 // 包装器数据类型.MAX_VALUE 该类型所能表示的最大值 .MIN_VALUE 该类型所能表示的最小值 // 用于判断溢出,比较最值 System.out.println("..

2020-08-14 17:19:39 142

原创 Java String, StringBuilder相关操作

//(一) String 不可变对象,默认为null // 对string对象的增删改等操作都会生成新的String对象,然后更改指针,效率低 // 经常发生改变的字符串最好不要用String // (1) 字符串对象的创建 String str1="hello"; // 字符串常量 char[] ch=new char[]{'h','e','l','l','o'}; StringBuilder sb=ne...

2020-08-14 15:27:33 287

原创 java中数组及Arrays、ArrayUtils工具类的相关操作

java中数组及Arrays、ArrayUtils工具类的相关操作 // (1) 创建一维数组, 三种创建方式 int[] iarr=new int[20]; String[] sarr={"a","b","c","d"}; double[] darr=new double[]{1.0,3.0,2.0}; Integer[] Iarr={1,2,3,4}; // (2) 创建二维数组: 维度固定与可变维度

2020-08-14 13:13:52 563

原创 一些软件安装或者使用样例资料整理

这里写自定义目录标题软件安装或入门资料整理Kylin软件安装或入门资料整理最近开始接触大数据相关知识,涉及到了hadoop, spark, hbase, hive等大量软件的安装、配置。中间遇到了不少坑,也查找了不少资料,但是之前一直没有整理,以致于现在重新配置时需要再重新查找资料。为此,从现在开始记录下以后一些软件安装过程中参考的一些较为不错的文章。Kylin安装https://blog.csdn.net/qq_18730505/article/details/82022532 (我之前将ha

2020-08-04 13:38:42 131

原创 IDEA_python带参执行_主函数参数解析_subprocess子进程使用_spark_submit提交参数解释

# IDEA python中 主函数设置参数 sys.argv可以调用所设置的参数,这里argv[0]是脚本的位置,argv[1]才是所设置的参数 # 在Run/Edit configuration中的param中进行设置 设置的参数以空格分割开 print(sys.argv[0]) main(sys.argv[1:]) #...

2019-10-29 22:10:41 841

原创 搭建hadoop+spark分布式中参考的几个博客

1 一步步教你Hadoop多节点集群安装配置 https://www.cnblogs.com/lanxuezaipiao/p/3525554.html2 Spark之——Hadoop2.7.3+Spark2.1.0 完全分布式环境 搭建全过程 https://blog.csdn.net/l1028386804/article/details/805167403 Ubuntu16.04安装Ha...

2019-09-08 15:43:54 133

原创 976. Largest Perimeter Triangle

Given an arrayAof positive lengths, return the largest perimeter of a triangle withnon-zero area, formed from 3 of these lengths.If it is impossible to form anytriangle of non-zero area, return...

2019-05-17 12:34:59 87

原创 949. Largest Time for Given Digits

Given an array of 4 digits, return the largest 24 hour time that can be made.The smallest 24 hour time is 00:00, and the largest is 23:59. Starting from 00:00, a time is larger if more time has ela...

2019-05-17 11:38:31 112

原创 1010. Pairs of Songs With Total Durations Divisible by 60

In a list of songs, thei-thsong has a duration oftime[i]seconds.Return the number of pairs of songs for which their totalduration in seconds is divisible by60. Formally, we want the number o...

2019-05-15 22:02:51 120

原创 1033. Moving Stones Until Consecutive

Three stones are on a number line at positionsa,b, andc.Each turn, you pick up a stone at an endpoint (ie., either the lowest or highest position stone), and move it to an unoccupied position bet...

2019-05-13 23:51:55 148

原创 973. K Closest Points to Origin

We have a list ofpointson the plane. Find theKclosest points to the origin(0, 0).(Here, the distance between two points on a plane is the Euclidean distance.)You may return the answer in any...

2019-04-23 16:07:48 154

原创 341. Flatten Nested List Iterator

Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list -- whose elements may also be integers or other lists.Example 1:Input: [[1,1],2...

2019-04-23 16:06:58 77

原创 347. Top K Frequent Elements

Given a non-empty array of integers, return thekmost frequent elements.Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [1]Note:You...

2019-04-23 00:03:19 79

原创 748. Shortest Completing Word

Find the minimum length word from a given dictionarywords, which has all the letters from the stringlicensePlate. Such a word is said tocompletethe given stringlicensePlateHere, for letters we ...

2019-04-22 23:16:10 114

原创 690. Employee Importance

You are given a data structure of employee information, which includes the employee'sunique id, hisimportance valueand hisdirectsubordinates' id.For example, employee 1 is the leader of employe...

2019-04-22 19:02:25 91

原创 1. Two Sum

Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not use thesame...

2019-04-22 18:43:34 73

原创 811. Subdomain Visit Count

A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode.com"...

2019-04-22 16:59:53 333

原创 378. Kth Smallest Element in a Sorted Matrix

Given anxnmatrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted order, not t...

2019-04-22 16:22:03 117

原创 451. Sort Characters By Frequency

Given a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:"tree"Output:"eert"Explanation:'e' appears twice while 'r' and 't' both appear once.So 'e'...

2019-04-18 13:25:09 108

原创 856. Score of Parentheses

Given a balanced parentheses stringS, compute the score of the string based on the following rule:()has score 1 ABhas scoreA + B, where A and B are balanced parentheses strings. (A)has score...

2019-04-18 12:56:40 126

原创 394. Decode String

Given an encoded string, return it's decoded string.The encoding rule is:k[encoded_string], where theencoded_stringinside the square brackets is being repeated exactlyktimes. Note thatkis gua...

2019-04-18 09:32:36 90

原创 389. Find the Difference

Given two stringssandtwhich consist of only lowercase letters.Stringtis generated by random shuffling stringsand then add one more letter at a random position.Find the letter that was adde...

2019-04-17 23:35:55 112

原创 136. Single Number

Given anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without us...

2019-04-17 23:21:23 78

原创 1025. Divisor Game

Alice and Bob take turns playing a game, with Alice starting first.Initially, there is a numberNon the chalkboard. On each player's turn, that player makes amoveconsisting of:Choosinganyxw...

2019-04-17 23:07:18 145

原创 1002. Find Common Characters

Given an arrayAof strings made only from lowercase letters, return a list of all characters that show up in all strings within the list(including duplicates).For example, if a character occurs 3 ...

2019-04-17 22:56:47 143

原创 771. Jewels and Stones

You're given stringsJrepresenting the types of stones that are jewels, andSrepresenting the stones you have. Each character inSis a type of stone you have. You want to know how many of the sto...

2019-04-17 22:41:37 68

原创 103. Binary Tree Zigzag Level Order Traversa

Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary tre...

2019-04-11 15:39:54 98

原创 921. Minimum Add to Make Parentheses Valid

Given a stringSof'('and')'parentheses, we add the minimum number of parentheses ('('or')', and in any positions ) so that the resulting parentheses string is valid.Formally, a parentheses s...

2019-04-11 15:12:21 82

原创 1019. Next Greater Node In Linked List

We are given a linked list withheadas the first node. Let's number thenodes in the list:node_1, node_2, node_3, ...etc.Each node may have anext largervalue: fornode_i,next_larger(node_i)i...

2019-04-11 14:47:22 147

原创 173. Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next smallest number in the BST.Example:...

2019-04-09 23:10:26 70

原创 844. Backspace String Compare

Given twostringsSandT,return if they are equal when both are typed into empty text editors.#means a backspace character.Example 1:Input: S = "ab#c", T = "ad#c"Output: trueExplanation: Bo...

2019-04-09 19:45:35 112

原创 961. N-Repeated Element in Size 2N Array

In a arrayAof size2N, there areN+1unique elements, and exactly one of these elements is repeated N times.Return the element repeatedNtimes.Example 1:Input: [1,2,3,3]Output: 3Examp...

2019-04-09 19:13:01 93

原创 1021. Remove Outermost Parentheses

A valid parentheses string is either empty(""),"(" + A + ")", orA + B, whereAandBare valid parentheses strings, and+represents string concatenation. For example,"","()","(())()", and"(()...

2019-04-09 18:47:19 566

原创 144. Binary Tree Preorder Traversal

Given a binary tree, return thepreordertraversal of its nodes' values.Example:Input:[1,null,2,3] 1 \ 2 / 3Output:[1,2,3]Follow up:Recursive solution is trivial, could...

2019-04-04 13:34:04 82

空空如也

空空如也

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

TA关注的人

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