RESET is a flag in TCP packets to indicate that the conection is not longer working. So, if any of the two participants in a TCP connection send a pac ...
分类:
其他好文 时间:
2020-04-18 09:16:18
阅读次数:
74
[TOC] 面向对象程序设计 结构化程序设计的缺点 我们为什么要有面向对象程序设计呢?我们使用 C 语言只能实现结构化程序设计,所谓结构化程序设计就是“ 程序 = 数据结构 + 算法 ”,而在程序中会有很多可以相互调用的函数和全局变量。 但是我们可以显然地看出,这种编程风格存在不少缺点。首先由于函数 ...
分类:
编程语言 时间:
2020-04-17 21:58:28
阅读次数:
161
本题要求编写程序,读入5个字符串,按由小到大的顺序输出。输入格式:输入为由空格分隔的5个非空字符串,每个字符串不包括空格、制表符、换行符等空白字符,长度小于80。输出格式:按照以下格式输出排序后的结果:After sorted:每行一个字符串代码如下:#!/usr/bin/python# -*- c... ...
分类:
编程语言 时间:
2020-04-17 14:01:54
阅读次数:
320
题目地址: "https://leetcode cn.com/problems/two sum/" 1.暴力解法 直接双重循环,枚举出所有可能的解,时间复杂度为O(n^2),空间复杂度为O(1) 2.HashTable 第一次循环将数组nums中的每个数都放入map中 第二次循环判断target n ...
分类:
其他好文 时间:
2020-04-17 00:50:56
阅读次数:
61
Problem: A?+?B is a problem used to test one's basic knowledge for competitive programming. Here is yet another boring variation of it. You have two i ...
分类:
其他好文 时间:
2020-04-16 22:50:39
阅读次数:
182
思路: sort()函数: sorted()函数 python中的进制转换内置函数 本题有两个排序条件: 二进制中‘1’的个数、十进制数值大小,因此用sort()和sorted()都可实现。 代码如下。 1 class Solution(object): 2 def sortByBits(self, ...
分类:
编程语言 时间:
2020-04-16 15:06:28
阅读次数:
93
面试题,要求用lambda一句话达到下方效果foo=[-5,8,0,4,9,-4,-20,-2,8,2,-4]正数从小到大,负数从大到小答案: res=sorted(foo,key=lambda x:(x<0 ,abs(x)))print(res) 由此展开对lambda的思考,lambda x:x ...
分类:
编程语言 时间:
2020-04-16 13:39:04
阅读次数:
179
老外里面, 孔乙己也很多,, 居然可以总结出这么多茴香豆的写法. https://www.techiedelight.com/join-two-lists-java/ 3个 4个 2个 ...
分类:
编程语言 时间:
2020-04-16 13:21:19
阅读次数:
733
1. abs( )函数返回数字的绝对值。 print( abs(-45)) # 返回 45print("abs(0.2):",abs(0.2)) # 返回 abs(0.2): 0.2 2. all( ) 函数用于判断给定的参数中的所有元素是否都为 TRUE,如果是返回 True,否则返回 False ...
分类:
编程语言 时间:
2020-04-15 16:26:42
阅读次数:
69
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1' ...
分类:
其他好文 时间:
2020-04-15 15:17:52
阅读次数:
68