单循环队列 q :用数组来记录数据 cap:代表数组的长度 len:代表元素的个数,取尾部元素可以根据头元素指针和这个值来进行计算 (queue head+queue len)%queue cap , 取余是为了在规定范围内循环使用有限空间 head:头元素的指针 出队:出头元素只需要将head往前 ...
分类:
其他好文 时间:
2020-04-23 21:07:34
阅读次数:
53
time模块 在Python中,通常有这几种方式来表示时间: 1. 时间戳(timestamp), 表示的是从1970年1月1日00:00:00开始按秒计算的偏移量。例子:1554864776.161901 2. 格式化的时间字符串,比如“2020 10 03 17:54” 3. 元组(struct ...
分类:
编程语言 时间:
2020-04-23 12:31:39
阅读次数:
67
一、题目说明 题目406. Queue Reconstruction by Height,队列每个元素包括 ,其中h是身高,k是身高不低于h的数量,请按照k和h重构队列。难度是Medium! 二、我的解答 这个题目理论上不难,但是细节不好处理。代码如下: 性能如下: 三、优化措施 这个用到map,用 ...
分类:
其他好文 时间:
2020-04-23 12:08:47
阅读次数:
67
1 #include<stdio.h> 2 #include<math.h> 3 #include<stdlib.h> 4 5 typedef struct stack1 { 6 char data[20]; 7 int top; 8 } StackChars; 9 10 typedef struc ...
分类:
其他好文 时间:
2020-04-22 19:42:01
阅读次数:
83
# tcp服务端 import socketserver import os import json import struct class MyRequestHandle(socketserver.BaseRequestHandler): def handle(self): while 1: tr ...
分类:
其他好文 时间:
2020-04-22 10:04:00
阅读次数:
50
1 前台,创建一个数据库类,可以在前台页面进行引用 引用方法为 include_once './pmysql.php'; 如果前台页面油循环的内容,需要用foreach来进行循环, <?php // 数据库类 class db{ private $ser; private $unam; privat ...
分类:
Web程序 时间:
2020-04-22 09:34:35
阅读次数:
79
# tcp服务端 import socketserver import subprocess import json import struct class MyRequestHandle(socketserver.BaseRequestHandler): def handle(self): # 创 ...
分类:
其他好文 时间:
2020-04-22 09:31:07
阅读次数:
63
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet ...
分类:
其他好文 时间:
2020-04-22 09:28:17
阅读次数:
63
服务端 import socket import struct import json import subprocess import os class MYTCPServer: address_family = socket.AF_INET socket_type = socket.SOCK_S ...
分类:
编程语言 时间:
2020-04-22 00:20:55
阅读次数:
98