找到约 10000 条结果
  • Array 系列
    由于本人一边要实习,一边要上课,最近刷题也是零零散散。一直都是按 LeetCode 官方默认顺序刷,一段时间刷下来,认为效率略低或者成长性比较低下,还是少了对思路的解析和总结,决定今天开始按 Tag 刷,也是便于自己总结和温故,一天一天先给文章贴上题目,总结日后再补上。愿每个努力的人,都不悔当初。好了,开始切入...
    2017-06-02
  • 330. Patching Array
    330. Patching Array 题目链接:[链接] 想了半天没想出来,参考discussion里的解法:[链接] {代码...}
    2017-02-16
  • Remove Duplicates from Sorted Array
    Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For example,Given input array nums = [1,1,2], Your function should return length =...
    2015-12-12
  • es5-Array
    es5_Array 迭代方法: forEach: {代码...} map: {代码...} filter: {代码...} some: {代码...} every: {代码...} 方法: {代码...} 缩小方法: reduce,reduceRight: {代码...} 判断方法: {代码...} 注释:这些方法不兼容ie8;
    2017-07-23
  • Leetcode: Search in Sorted Array
    For [4, 5, 1, 2, 3] and target=1, return 2.For [4, 5, 1, 2, 3] and target=0, return -1.
    2017-09-10
  • [LintCode/LeetCode] Rotate Array
    Given an array, rotate the array to the right by k steps, where k is non-negative.
    2018-07-18
  • ES6 Array
    ES6 Array 首先先定义一个数组 {代码...} forEach() forEach会遍历数组, 没有返回值,不允许在循环体内写return,不会改变原来数组的内容 forEach() 有三个参数,第一个是arr数组里面的值,第二个是arr数组索引,第三个是arr数组本身的指引 {代码...} map() map 遍历数组, 会返回一个新数组,不会改变原来数组里的内容 m...
    2018-07-04
  • JavaScript Array.find()
    在写一个数组查找元素的代码中使用了Array.find() 方法但却并没有像想象中那样当遇到符合条件的值返回这个 , 停止执行这个方法而是继续的执行下去了。
    2020-05-15
  • Array对象
    构造函数静态方法Array.isArray()实例方法valueOf(),toString()push(),pop()shift(),unshift()join(分隔符)返回字符串concat()新的reverse()slice(头尾)新的splice(头,长,增)增(头,0,增)拆成两个(头)返回删除的sort()map()新的 thisforEach()不返回 thisfilter()新的 返回ture的some(),every()新的 返turee ...
    2019-07-23
  • leetcode 665 Non-decreasing Array
    Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <= array[i + 1] holds for every i (1 <= i < n). 给定一个整数数组,如果最多改变一个元素的值,就可使整个数组元素的值单调递...
    2018-02-05
  • 七牛刷新接口php实现参考
    「接口文档」([链接]) {代码...}
    2016-09-08
  • Reverse Words in a String
    Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the".
    2016-06-10
  • 短信API接口demo示例-PHP/Message/MultiSend
    DEMO:Message/MultiSend原文链接代码示列 {代码...}
    2022-03-22
  • valueForKeyPath
    可能大家对- (id)valueForKeyPath:(NSString *)keyPath方法不是很了解。 其实这个方法非常的强大,举个例子:
    2014-05-31
    2
  • 用 new Function 提高运行效率
    为了减小列表数据的尺寸,后端把json处理成数组返回(类似于csv)。格式如下: {代码...} 前端获取到数据后解析,格式如下: {代码...} 优化前正常的解析代码: {代码...} 运行一个 24000 行,每行 94 个字段的数组,大概需要 400 毫秒 优化思路:省去中间 forEach 遍历赋值 {代码...} 用 new Function 来构造中间的 ret...
    2018-12-18
  • 《剑指offer》1. 二维数组中的查找【Java+Python】
    在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
    2020-08-15
  • [Leetcode]32.Longest Valid Parentheses
    Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest valid parentheses substring is"()"Example 2:Input: ")()())"Output: 4Explanation: The longest valid parentheses s...
    2019-11-23