ICode9

精准搜索请尝试: 精确搜索
  • 112022-09-02 18:00:28

    function getItem (data) {     for (let i = 0; i < data.length; i++) {         const oItem = data[i];         if (oItem.type === '1') {             return [oItem.id];         } else {             if (oItem.children && oItem.children.

  • mysql查询数据库和数据表占用内存大小2022-09-02 13:02:19

    -- 查看所有数据库容量大小selecttable_schema as '数据库',sum(table_rows) as '记录数',sum(truncate(data_length/1024/1024/1024, 2)) as '数据容量(GB)',sum(truncate(index_length/1024/1024/1024, 2)) as '索引容量(GB)'from information_schema.tables

  • js 实现选择排序及优化2022-09-02 12:02:17

    // 选择排序 // 原理:进行 n-1 趟 循环,每趟循环中遍历所有未排好序的数,第一趟循环,从第0个元素开始向后遍历,找到 最小的元素,与第1 一个元素进行交换,第二趟,从第 1 个元素开始向后遍历,找到最小值与第2个元素 进行交换,以此类推 // 从而得出规律,每次遍历元素开始位置为 i+1,并维护每轮

  • js 金额计算异常解决方法2022-09-02 09:04:48

    日常开发中,常规计算快捷展示,一般针对金额计算。例如购物车、批量操作数据展示总金额等等,一般都是前端负责处理,并且性能交互效果好,但是会衍生一个很大的问题。小学水平的计算,js居然计算出这么大的问题,难道是读书不听课???这里涉及一个问题,js的计算精度。计算机的数据底层是0和1,二进制

  • [Typescript Challenges] 5. Easy - Length of Tuple2022-09-02 02:02:04

    For given a tuple, you need create a generic Length, pick the length of the tuple For example: type tesla = ['tesla', 'model 3', 'model X', 'model Y'] type spaceX = ['FALCON 9', 'FALCON HEAVY', &

  • 矩阵类问题处理技巧2022-08-31 21:02:04

    矩阵类问题处理技巧 作者:Grey 原文地址: 博客园:矩阵类问题处理技巧 CSDN:矩阵类问题处理技巧 给定一个正方形矩阵,原地调整成顺时针90度转动的样子 题目链接见:LeetCode 48. Rotate Image 本题主要的限制条件是:原地调整,即不开辟额外的二维数组来做。 主要思路如下 第一步,先处理外围的

  • R语言中seq函数2022-08-30 13:30:27

      001、 seq(10) seq(2, 10, 2) ## 设置起始位置, 步长     002、 seq(2, 10, length = 2) ## 设置返回值的个数 seq(2, 10, length = 3) seq(2, 10, length = 4)  

  • leetcode 每日一题 1470. 重新排列数组2022-08-29 17:00:20

    leetcode  每日一题 1470. 重新排列数组 class Solution { public int[] shuffle(int[] nums, int n) { int[] arr = new int[nums.length]; for (int i = 0; i < nums.length; i++) { if(i < n){ arr[i*2] = nums[i];

  • js实现幻灯片2022-08-29 15:00:19

    使用原生js实现轮播图 html代码 <div class="slide"> <ul> <li style="display: block;"> <img src="1.jpg"> </li> <li> <im

  • state machine2022-08-29 01:31:34

    2370. Longest Ideal Subsequence Medium You are given a string s consisting of lowercase letters and an integer k. We call a string t ideal if the following conditions are satisfied: t is a subsequence of the string s. The absolute difference

  • JavaScript的函数2022-08-28 20:00:12

    //alert是JavaScript语言提供的一个警告函数//它可以接收任意类型的参数,这个参数就是警告框的提示信息       <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script type="text/javascript"&

  • leetcode198:打家劫舍2022-08-28 18:03:10

    package com.mxnet; public class Solution198 { public static void main(String[] args) { } /** * 你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金 * 影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统, * 如果

  • LeetCode 1347. Minimum Number of Steps to Make Two Strings Anagram2022-08-28 16:03:29

    原题链接在这里:https://leetcode.com/problems/minimum-number-of-steps-to-make-two-strings-anagram/ 题目: You are given two strings of the same length s and t. In one step you can choose any character of t and replace it with another character. Return th

  • 最大正方形2022-08-28 13:04:03

    问题:在一个由 '0' 和 '1' 组成的二维矩阵内,找到只包含 '1' 的最大正方形,并返回其面积。      输入:matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1&q

  • 小心使用select的length属性2022-08-27 19:30:08

    本文主要讲述两点:1.select在只有一个和多个的时候length代表的意义是不一样的2.怎么让length具有唯一的意义. 先让我们看两个例子例1:<p><select size="1" name="D1"><option>sfdsf</option><option>ghjgfhfg</option><option>qwewqe</option></select

  • Apple开发_字符串与Unicode编码的互转2022-08-27 14:33:06

    // 字符串 转Unicode - (NSString *)utf8ToUnicode:(NSString *)string { NSUInteger length = [string length]; NSMutableString *str = [NSMutableString stringWithCapacity:0]; for (int i = 0; i < length; i++) { NSMutableString *s = [NSMutableS

  • P1415 题解2022-08-26 03:04:35

    前言 题目传送门! 更好的阅读体验? 这题是一道挺好的 \(\texttt{dp}\) 题啊,但大家的题解都写得不够详细。 所以,我来补一篇 \(\LaTeX\) 题解,希望能帮助大家。 思路 首先是读入,为了方便,我让字符串下标从 \(1\) 开始。 string a; int n; //字符串长度。 void Input() { cin >> a; //

  • 用JavaScript实现排序算法(冒泡排序、选择排序、插入排序、快速排序、归并排序)2022-08-25 23:32:26

    冒泡排序 思路:   对未排序的各元素从头到尾依次比较相邻的两个元素大小关系 如果左边的队员高, 则两队员交换位置 向右移动一个位置, 比较下面两个队员 当走到最右端时, 最高的队员一定被放在了最右边 按照这个思路, 从最左端重新开始, 这次走到倒数第二个位置的队员即

  • 看下不同的代码书写方式2022-08-24 16:34:43

    代码非常简单,就是根据传入字符的不同,返回向量的最大或最小值而已: 1 function [out] = myminvec(vec, c) 2 %myminvec returns the minimum value in a vector 3 %Format: myminvec(vector,c) 4 5 out = vec(1); 6 if c == 'm' 7 for i = 2:length(vec) 8 if

  • 数组2022-08-23 15:33:37

    public static void main(String[] args) { int a[] = {1,2,3,4,5}; //遍历数组 for (int i = 0; i < a.length; i++) { System.out.println(a[i]); } //计算数组所有元素的和 int sum = 0; for (int i = 0; i < a.length; i++) { sum+=a[i];

  • 【Java基础】二维数组实现杨辉三角2022-08-22 20:03:35

    1.什么是杨辉三角 每一行头尾都为1,每个数都等于上面两个数之和 arr[3][1] = arr[2][0]+arr[2][1]; arr[3][2] = arr[2][1]+arr[2][2]; 2.实现 int[][] arr = new int[10][]; //数组元素赋值 for (int i = 0; i < arr.length; i++) { arr[i

  • JAVA基础--数组--2022年8月21日2022-08-22 13:03:35

    第一节 数组静态定义方式   1、数组的静态初始化的写法和特点是什么样的?           2、数组属于什么类型,数组变量中存储的是什么?     引用数据类型,存储的是数组在内存中的地址信息 第二节  数组的访问   1、如何访问数组的元素     数组名称[索引]   2、如

  • JavaScript实现数字前补“0”的五种方法示例2022-08-22 09:31:17

    来自:https://www.jb51.net/article/153945.htm 侵删 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">

  • 936. Stamping The Sequence2022-08-22 07:30:50

    You are given two strings stamp and target. Initially, there is a string s of length target.length with all s[i] == '?'. In one turn, you can place stamp over s and replace every letter in the s with the corresponding letter from stamp. For ex

  • JS compose 函数实现2022-08-22 00:31:54

    function compose(...funcs) { let length = funcs.length; if (length === 0) { return (arg) => arg; } if (length === 1) { return funcs[0]; } return funcs.reduce( (a, b) => (...args) =>

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有