package LeetCode_1365 import java.util.* /** * 1365. How Many Numbers Are Smaller Than the Current Number * https://leetcode.com/problems/how-many-num ...
分类:
其他好文 时间:
2020-06-04 19:56:56
阅读次数:
67
##判断素数 最简单的判断就是根据素数的定义:只有两个因子1和本身(1不是素数)。时间复杂度O(n) bool is_prime(int x){ if(x == 1) return false; rep(i , 2 , n-1){ if(x % i == 0){ return false; } } ...
分类:
其他好文 时间:
2020-06-04 19:40:06
阅读次数:
58
模板 函数模板 思考:如果重载的函数,其解决问题的逻辑是一致的、函数体语句相同,只是处理的数据类型不同,那么写多个相同的函数体,是重复劳动,而且还可能因为代码的冗余造成不一致性。 解决:使用模板 例:求绝对值函数的模板 函数模板定义语法 语法形式: template <模板参数表> 函数定义 模板参 ...
分类:
编程语言 时间:
2020-06-04 10:47:03
阅读次数:
77
31把数组排成最小的数 输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。例如输入数组{3,32,321},则打印出这三个数字能排成的最小数字为321323。 比较两个字符串s1, s2大小的时候,先将它们拼接起来,比较s1+s2,和s2+s1那个大,如果s ...
分类:
其他好文 时间:
2020-06-02 18:58:11
阅读次数:
61
bool vis[maxn]; int prime[maxn]; int Mob[maxn]; void Mobius_sieve(){ int cnt = 0; vis[1] = 1; Mob[1] = 1; for(int i = 2; i <= maxn; i++){ if(!vis[i]) ...
分类:
其他好文 时间:
2020-05-31 18:16:00
阅读次数:
80
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], ...
分类:
其他好文 时间:
2020-05-31 13:17:49
阅读次数:
57
Vue的列表渲染 注:其实使用的还是相关的vue的指令进行相应的数据绑定和渲染 在前边写过一个博客来说指令的相关内容但是写的不细,就是写了相应的使用方法,在此要提到之前遇到的一个问题 就是前端拿到返回数据进行数据渲染·列表展示的时候,之前就是直接解析出数组直接在DOM上边写一个v-for 进行数据渲 ...
分类:
其他好文 时间:
2020-05-31 13:15:50
阅读次数:
145
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the ...
分类:
其他好文 时间:
2020-05-31 12:44:37
阅读次数:
59
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb ...
分类:
其他好文 时间:
2020-05-31 12:43:12
阅读次数:
52
LeetCode的第一题,英文单词书中 Abandon 一般的存在,让我们来看一下题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. ...
分类:
编程语言 时间:
2020-05-31 11:10:15
阅读次数:
107