题目: 给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。 示例: 输入: 3 输出: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] 代码: 1 class Solution { 2 public int[][] ...
分类:
其他好文 时间:
2020-12-30 10:52:55
阅读次数:
0
Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your ...
分类:
其他好文 时间:
2020-12-29 11:18:24
阅读次数:
0
<el-menu class="left-menu" :default-active="$route.name" :unique-opened="true" :collapse="isCollapse"> <template v-for="(m, x) in menuOpts.data" > <el ...
分类:
其他好文 时间:
2020-12-28 10:57:57
阅读次数:
0
考虑莫队。 如果是单纯的莫队的话,还需要一个树状数组来维护逆序对数,这样子的话复杂度是 \(O(n^{1.5}\log n)\),难以接受。 怎么将这个树状数组消除? 考虑当前区间为 \([l,r-1]\) ,需要将右端点向右移动,即加入 \(a_r\) ,并且将答案加上 \(a_{l,l+1,\c ...
分类:
其他好文 时间:
2020-12-25 12:28:35
阅读次数:
0
4Sum II (M) 题目 Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is ze ...
分类:
其他好文 时间:
2020-12-22 12:32:53
阅读次数:
0
hadoop Shuffle Error: Exceeded MAX_FAILED_UNIQUE_FETCHES; bailing-out 程序里面需要打开多个文件,进行分析,系统一般默认数量是1024,(用ulimit -a可以看到)对于正常使用是够了,但是对于程序来讲,就太少了。修改办法:修改2 ...
分类:
其他好文 时间:
2020-12-19 13:37:26
阅读次数:
3
给定一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。表为无头结点、单向。(由于涉及到结构体,所以写不了完整的测试代码,下面展示的代码为LeetCode中写的代码) //第一次尝试://方法:图文解释: //当然,这个方法有点不好想,我们还可以这样做:(这里就不演示了) st ...
分类:
其他好文 时间:
2020-12-19 12:20:15
阅读次数:
1
import pymysql from pymysql.cursors import DictCursor # class Field: # def __init__(self,name,column=None,chief=False,unique=False,index=False,nullabl ...
分类:
数据库 时间:
2020-12-18 13:13:19
阅读次数:
4
from docx.shared import Pt,RGBColor from docx.oxml.ns import qn #word中字体的颜色、大小、字体def style(tt,tsize,color,rfont): for ii in tt: for run1 in ii.runs: f ...
分类:
其他好文 时间:
2020-12-16 12:37:51
阅读次数:
2
ST表的功能很简单 它是解决RMQ问题(区间最值问题)的一种强有力的工具 它可以做到O(nlogn)预处理,O(1)查询最值 ST表是利用的是倍增的思想 拿最大值来说 我们用Max[i][j]表示,从i位置开始的2j个数中的最大值,例如Max[i][1]表示的是ii位置和i+1位置中两个数的最大值 ...
分类:
其他好文 时间:
2020-12-14 13:48:47
阅读次数:
3