地址 https://leetcode-cn.com/problems/spiral-matrix-ii/ 给你一个正整数 n ,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的 n x n 正方形矩阵 matrix 。 示例 1: 输入:n = 3 输出:[[1,2,3],[8, ...
分类:
其他好文 时间:
2021-04-06 14:49:59
阅读次数:
0
输入:时间字符串“yyyy-MM-dd” private String subMonth(String date) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date dt = ...
分类:
编程语言 时间:
2021-04-06 14:42:38
阅读次数:
0
给定 $n$ 个数字,要划分成 $A,B$ 两个集合。要求对任意 $x$,若 $x$ 在 $A$ 中则 $a-x$ 也在 $A$ 中,若 $x$ 在 $B$ 中则 $b-x$ 也在 $B$ 中。保证数互不相同。 ...
分类:
其他好文 时间:
2021-04-06 14:31:06
阅读次数:
0
02 add two numbers 1. 题目讲解 给定两个链表,每个链表表示一个整数,求这两个整数之和。结果也还是用链表表示。 2. 题解 思路: ? 本质上这道题是两个数带进位的加法。两个对应位置上的和是和对10取余。进位则是和整除10. class Solution { public: Li ...
分类:
其他好文 时间:
2021-04-06 14:12:17
阅读次数:
0
Ubuntu 安装软件源拓展工具: apt -y install software-properties-common apt-transport-https lsb-release ca-certificates 添加 Ond?ej Surý 的 PHP PPA 源,需要按一次回车: add-ap ...
分类:
Web程序 时间:
2021-04-06 14:11:12
阅读次数:
0
inet_pton 字符串转为网络字节序整数,网络字节序可以直接用于sockaddr_in。 #include <sys/socket.h> #include <netinet/in.h> #include<arpa/inet.h> atoi 字符串是ASCII 将字符串转为整数 #include ...
分类:
其他好文 时间:
2021-04-06 14:05:37
阅读次数:
0
s = set('hello,word') print(s) #set 方法 s = {'xiaoming', 'xiaoming', 'xiaoming1'} print(s) s.add('s') # 添加元素 s.clear(s) # 清空集合 s1 = s.copy(s) # 复制集合 s. ...
分类:
编程语言 时间:
2021-04-05 12:51:32
阅读次数:
0
编号104:二叉树的最大深度 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树 [3,9,20,null,null,15,7], 返回它的最大深度 3 。 思路 递归实现:先找左子树的最大深度;再找 ...
分类:
其他好文 时间:
2021-04-05 12:45:42
阅读次数:
0
对于给定的一个字符串,统计其中数字字符出现的次数。 类和函数接口定义: 设计一个类Solution,其中包含一个成员函数count_digits,其功能是统计传入的string类型参数中数字字符的个数并返回。 裁判测试程序样例: #include <cstdlib> #include <cstdio ...
分类:
其他好文 时间:
2021-04-05 12:37:04
阅读次数:
0
Sublime Text 3 https://www.sublimetext.com/ Preferences --> Settings File Path: C:\Users\wuyong\AppData\Roaming\Sublime Text 3\Packages\User\Preferenc ...
分类:
其他好文 时间:
2021-04-05 12:36:42
阅读次数:
0