码迷,mamicode.com
首页 >  
搜索关键字:arr    ( 7133个结果
数组的应用
1.数组的遍历 通常用双for循环或者foreach循环来遍历二维数组,例如: char arr[][]=new char[4][]; arr[0]=new char[] {'春','江','潮','水','连','海','平'}; arr[1]=new char[] {'海','上','明','月 ...
分类:编程语言   时间:2021-04-06 14:14:36    阅读次数:0
1588. 所有奇数长度子数组的和
暴利求解法 设置tem记录每个元素的累加和,当为奇数的时候,将tem值与sum值累加,完成所有遍历,即所有奇数长度子数组的和 class Solution { public int sumOddLengthSubarrays(int[] arr) { int sum=0; if(arr.length ...
分类:编程语言   时间:2021-04-02 13:31:40    阅读次数:0
冒泡排序
总经理说:不管将来干什么,一定要夯实基础,一通百通,融会贯通。我觉得现在不管干着什么,基础也要学而时习之。//冒泡排序private static void sort(int[] arr) { for (int i = 0; i < arr.length-1; i++) {//5、因为两个元素比较一 ...
分类:编程语言   时间:2021-04-01 13:43:24    阅读次数:0
移动端图片处理
import EXIF from 'exif-js' // 处理移动端拍摄照片旋转的问题 dataURLtoFile (dataurl, filename) { /* eslint-disable */ var arr = dataurl.split(','), mime = arr[0].matc ...
分类:移动开发   时间:2021-04-01 13:15:06    阅读次数:0
展开符的使用
展开符的使用 展开一个数组 let arr = [1,3,5,7,9]; console.log(...arr); // 1 3 5 7 9 连接一个数组 let arr = [1,3,5,7,9]; let arr1 = [2,4,6,8,10] console.log(...arr,...arr ...
分类:其他好文   时间:2021-03-31 12:36:01    阅读次数:0
搞懂二分查找
class Solution { public static void main(String[] args) { int[] arr = new int[]{0, 1, 2, 2, 2, 3, 4, 5}; //int index = binarySearch(arr, 2); //int ind ...
分类:其他好文   时间:2021-03-31 11:46:55    阅读次数:0
(JavaSE)Java数组、内存分析、初始化
#数组的定义 数组是相同类型数据的有序集合 数组描述的是相同类型的若干个数据,按照一定的先后次序排列组合而成 其中,每一个数据称作一个数组元素,每个数组元素可以通过一个下标来访问它们 #数组声明创建 首先必须声明数组变量,才能在程序中使用数组。下面是声明数组变量的语法: dataType[] arr ...
分类:编程语言   时间:2021-03-30 13:59:38    阅读次数:0
取数组最大值和最小值
var arr = [1,2,3,4,5,6] console.log(Math.max.apply(null,arr.join(',').split(','))) //6 console.log(Math.min.apply(null,arr.join(',').split(','))) //1 ...
分类:编程语言   时间:2021-03-30 13:48:22    阅读次数:0
[LeetCode] 1089. Duplicate Zeros 复写零
Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond ...
分类:其他好文   时间:2021-03-30 12:46:57    阅读次数:0
排序算法
冒泡排序 1.动图演示 2.代码实现 private static void bubbleSort(int[] arr) { if (arr.length <= 1) return; for (int i = 0; i < arr.length; i++) { // 用于标识数组是否有序 boole ...
分类:编程语言   时间:2021-03-16 13:24:13    阅读次数:0
7133条   上一页 1 ... 7 8 9 10 11 ... 714 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!