找到约 10000 条结果
  • 优化 cJSON 库的 array 插入速度
    和参考资料一样,我在我的项目中应用 cJSON 数组功能,发现在创建 array 的时候耗时很厉害(作为嵌入式 CPU,几十个 array 项的插入,居然花了 300ms)。搜了一下,网上已经有人遇到过了,就是参考资料的那篇。本文解释一下优化的思路和方法。
    2016-10-17
  • 快速排序&归并排序
    时间复杂度:最坏O(n^2) 当划分不均匀时候 逆序and排好序都是最坏情况最好O(n) 当划分均匀partition的时间复杂度: O(n)一共需要logn次partition
    2016-01-08
    1
  • laravel 中 in 多列特殊查询类型解决方案
    SQL 查询中有一种 in 多列特殊查询类型,大概是这个样子 select * from order where (id,buyer) in(( 1, '张三' ),( 2, '李四' )) and order.deleted_at is null。laravel 的查询构建器并没有直接支持该类型的查询。我这边通过查询构建器 Macroable 新增了一个 whereIns 查询方法方便该类型的查询。
    2022-07-05
  • [LintCode/LeetCode] Sliding Window Maximum/Median
    Given an array of n integer with duplicate number, and a moving window(size k), move the window at each iteration from the start of the array, find the maximum number inside the window at each moving.
    2016-08-29
  • 数组取交集、并集、差集、去重
    //集合取交集 {代码...} //集合去掉重复 {代码...} //并集 {代码...} //2个集合的差集 在arr不存在 {代码...} {代码...}
    2017-06-20
  • JS 数组倒序排列
    前端要给数组实现倒序排列,有如下两种简单实现方案: 1. 使用 reverse() 函数: {代码...} 注意此方法会改变原来的数组,而不会创建新的数组。2. 循环遍历: {代码...} 3*. 如果想让字符串倒序排列,也可以借用数组倒序排列的思想:利用 split() 将字符串按特定的方式分割为数组,reverse() 用于颠倒数组顺序,最后再用...
    2020-11-18
  • Frida Hook Md5加密类
    改一下包名即可使用 {代码...}
    2022-06-23
  • NumPy 分割与搜索数组详解
    array: 要分割的 NumPy 数组。indices_or_sections: 指定分割位置的整数列表或要包含每个子数组的元素数量的列表。axis: 可选参数,指定要分割的轴。默认为 0(即行分割)。
    2024-05-16
  • PHP多文件上传格式化
    文件上传是所有web应用中最常见的功能,而PHP实现这一功能也非常的简单,只需要前端设置表单的 enctype 值为 multipart/form-data 之后,我们就可以通过 $_FILES 获得表单中的 file 控件中的内容。
    2021-04-15
  • Javascript 中的 Array 操作
    在各种语言中,数组总是一个比较重要的数据结构,Javascript 中的 Array 也不例外。Javascript 中的 Array 提供了一系列方法可以更好地让我们操作 Array 中的元素,下面我们就来看看这些操作方法。
    2015-10-10
  • JavaScript30秒, 从入门到放弃之Array(四)
    Returns the n maximum elements from the provided array. If n is greater than or equal to the provided array's length, then return the original array(sorted in descending order). Use Array.sort() combined with the spread operator (...) to create a shallow clone of the array and sort it in descendi...
    2018-01-20
  • PHP中数组赋值性能及过程
    今天导出报表时,测试同事告诉我数据太大了,无法导出。我看了下大概只有1500条左右的数据,完全不大。估计是上午将数据写入数组时方式不对。修改了下果然ok了。参考vld用法:[链接]mac下安装vld扩展:[链接](第一次记录文章,还不熟悉排版)
    2017-02-09
  • JavaScript 中 15 种常见的数组操作
    点赞再看,养成习惯本文 GitHub [链接] 上已经收录,更多往期高赞文章的分类,也整理了很多我的文档,和教程资料。欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。
    2020-06-08
  • JavaScript专题之数组去重
    在这个方法中,我们使用循环嵌套,最外层循环 array,里面循环 res,如果 array[i] 的值跟 res[j] 的值相等,就跳出循环,如果都不等于,说明元素是唯一的,这时候 j 的值就会等于 res 的长度,根据这个特点进行判断,将值添加进 res。
    2017-06-21
    2
  • leetcode 697 Degree of an Array
    Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums.
    2018-02-05
  • es5_Array
    es5_Array 迭代方法: forEach: {代码...} map: {代码...} filter: {代码...} some: {代码...} every: {代码...} 索引方法: {代码...} 缩小方法: reduce,reduceRight: {代码...} 判断方法: {代码...} 注释:这些方法不兼容ie8;
    2017-07-23
  • Kth largest element in array
    数组中的第K个最大元素 - 力扣(LeetCode) 在未排序的数组中找到第 k 个最大的元素。请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。 示例 1:输入: [3,2,1,5,6,4] 和 k = 2输出: 5 示例 2:输入: [3,2,3,1,2,4,5,5,6] 和 k = 4输出: 4 说明:你可以假设 k 总是有效的,且 1 ≤ k ≤ 数组的...
    2019-08-06