int func(int n){ int i = 0,sum = 0; while(sum < n) sum += ++i; return i; } 求时间复杂度 A. O(logn) B. O(n^1/2) C. O(n) D. O(nlogn) ++i, i = 1,2,3,4,5,···,k。 ...
分类:
其他好文 时间:
2021-04-10 13:08:02
阅读次数:
0
递归求1-100之和 /* *求1-100之和 */ function sum(num1, num2) { var num = num1 + num2; if (num2 + 1 > 100) { return num; } else { return sum(num, num2 + 1) } } ...
分类:
其他好文 时间:
2021-04-10 13:03:05
阅读次数:
0
2.1.C语言的汇编表示 c语言代码 int plus(int x,int y) { return 0; } void main() { __asm { mov eax,eax } //调用函数 plus(1,2); return; } 汇编代码 1: 2: int plus(int x,int y ...
分类:
编程语言 时间:
2021-04-10 12:50:12
阅读次数:
0
改变原数组方法 splice() : 返回删除项组成的数组 sort() reverse() fill() : 初始化数组 例如:new Array(26).fill(0) pop() push() shift() unshift() 不改变原数组方法 slice(begin ? ,end ?) : ...
分类:
编程语言 时间:
2021-04-09 13:42:08
阅读次数:
0
var arr =["George","John","Thomas","James","Adrew","Martin"] let mm = arr.splice(2,3) console.log(arr) // 结果 ["George","John","Martin"] 如果arr不赋给某个值,直接 ...
分类:
Web程序 时间:
2021-04-09 13:41:43
阅读次数:
0
<template> <div>{{propContent}}</div> </template> <script> import { watchEffect, watch, ref } from "vue"; export default { name: "", components: {}, m ...
分类:
其他好文 时间:
2021-04-09 13:36:07
阅读次数:
0
JavaScript语言中,生成实例对象的传统方法是通过构造函数 function Point(x,y){ this.x = x; this.y = y; } Point.prototype.toString = function (){ return '('+this.x + ',' + this ...
分类:
其他好文 时间:
2021-04-09 13:35:12
阅读次数:
0
349. 两个数组的交集 题目描述: 给定一个整数数组 A,如果它是有效的山脉数组就返回 true,否则返回 false。 让我们回顾一下,如果 A 满足下述条件,那么它是一个山脉数组: A.length >= 3 在 0 < i < A.length - 1 条件下,存在 i 使得: A[0] < ...
分类:
编程语言 时间:
2021-04-09 13:33:22
阅读次数:
0
描述 给一整数 n, 返回杨辉三角的前 n 行 0 ? n ? 20 杨辉三角也被叫做帕斯卡三角形. --(Wikipedia) 样例 样例 1: 输入 : n = 4 输出 : [ [1] [1,1] [1,2,1] [1,3,3,1] ] class Solution: """ @param n ...
分类:
其他好文 时间:
2021-04-09 13:21:46
阅读次数:
0
描述 给你一个数组和两个索引,交换下标为这两个索引的数字 样例 样例 1: 输入: [1, 2, 3, 4], index1 = 2, index2 = 3 输出: 交换后你的数组应该是[1, 2, 4, 3], 不需要返回任何值,只要就地对数组进行交换即可。 样例解释: 就地交换,不需要返回值。 ...
分类:
编程语言 时间:
2021-04-09 13:17:40
阅读次数:
0