质数 大于1的整数中,如果只包含1和它本身这两个约数,就被称为质数,也叫素数 质数的判定 试除法 时间复杂度O(sqrt(n)) bool isprime(int x){ if(x < 2) return 0; for(int i=2;i <= x/i;i++){ if(x%i==0) return ...
参考官方文档:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions 其中说: // 当箭头函数的函数体只有一个 `return` 语句时,可以省略 `return` 关键 ...
分类:
编程语言 时间:
2020-07-06 13:13:50
阅读次数:
129
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. 给n个不同的数,求0-n这n+1个数里缺了哪个 利用异或运算的性 ...
分类:
其他好文 时间:
2020-07-06 12:45:24
阅读次数:
55
脚本源码:#!/bin/bashecho_caidan() {# 清空防火墙规则read -ep "是否清空防火墙规则(y/n):" nameif [ $name == y ];then iptables -F echo " 1) 放行端口 2) 封锁端口 3) 放行ip 4) 封锁ip "else... ...
分类:
系统相关 时间:
2020-07-06 11:04:21
阅读次数:
99
数组迭代方法对每个数组项进行操作。 Array.forEach() forEach() 方法为每个数组元素调用一次函数(回调函数)。 实例 var txt = ""; var numbers = [45, 4, 9, 16, 25]; numbers.forEach(myFunction); fun ...
分类:
编程语言 时间:
2020-07-05 15:41:09
阅读次数:
61
周赛地址(英):weekly contest 196 周赛地址(中):第 196 场周赛 仓库地址:week-Leetcode 1502. Can Make Arithmetic Progression From Sequence Given an array of numbers arr. A s ...
分类:
其他好文 时间:
2020-07-05 13:51:11
阅读次数:
57
题目信息 时间: 2019-07-03 题目链接:Leetcode tag:动态规划 小根堆 难易程度:中等 题目描述: 我们把只包含质因子 2、3 和 5 的数称作丑数(Ugly Number)。求按从小到大的顺序的第 n 个丑数。 示例: 输入: n = 10 输出: 12 解释: 1, 2, ...
分类:
其他好文 时间:
2020-07-04 17:19:58
阅读次数:
66
题意:字符串与数字的13进制转换 AC代码 方法一:循环方式存入 13 * 13 个数后输出 1 #include<bits/stdc++.h> 2 using namespace std; 3 string unit[] = {"tret", "jan", "feb", "mar", "apr", ...
分类:
其他好文 时间:
2020-07-04 13:50:47
阅读次数:
65
package LeetCode_295 import java.util.* /** * 295. Find Median from Data Stream * https://leetcode.com/problems/find-median-from-data-stream/descripti ...
分类:
其他好文 时间:
2020-07-04 01:10:12
阅读次数:
49
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function ...
分类:
其他好文 时间:
2020-07-03 21:49:23
阅读次数:
77