Tag:array

  • Efficient use of array. From()

    Time:2020-1-17

    Rule of grammar const someNumbers = { ‘0’: 10, ‘1’: 15, length: 2 }; Array.from(someNumbers, value => value * 2); // => [20, 30] Convert a class array to an array The array objects you will encounter are: the arguments keyword in the function, or a DOM collection.In the following example, let’s sum the parameters […]

  • Full Permutation of PHP implementation strings

    Time:2020-1-17

    Enter a string and print all the permutations of the characters in the string in dictionary order. For example, if you input the string a B C, all the strings ABC, a C B, BAC, B C A, cab and CBA that can be arranged by the characters a, B and C will be printed […]

  • Getting started with PHP Basics

    Time:2020-1-16

    Variables and scopes $globals [index]. Index holds the name of the variable. This array can be accessed inside a function or used directly to update global variables. Static scopeKeep a local variable from being deleted Parameter scope Echo and print Echo – can output one or more strings Print – only one string is allowed […]

  • Special object array in JS

    Time:2020-1-16

    Preface Previously learned data types can only store one value (for example: number / string). I want to store multiple values in a variable. How should I store them? The so-called array is to arrange multiple elements (usually of the same type) in a certain order into a collection, which we call array. 1.1 array […]

  • New features of PowerShell 6,7

    Time:2020-1-16

    What’s new in PowerShell 6, 7.1. Each feature has a version number. Only from this version can this feature be supported.2 welcome to find fault, let me perfect the post.Most of them are new features of PS6. PS7 is just beginning to develop, and there are only a few new features.       —————————————————————-┏┳━━━━━━━━━━━┓┃┃███████████┃┃┃███████████┃┣┫███████┏━┓█┃┃┃███████┃P┃█┃┃┃███████┃O┃█┃┃┃███████┃┃███┃┃█┃█┃┣┫███████┃E┃█┃┃┃███████┃R┃█┃┃┃███████┃S┃█┃┃┃███████┃H┃█┃┣┫███████┃E┃█┃┃┃███████┃┃███┃┃█┃█┃┃┃███████┃L┃█┃┃┃███████┗━┛█┃┣┫███████████┃┃┃███V6.0██████┃┃┃███████████┃┗┻━━━━━━━━━━━┛ […]

  • Go – cycle

    Time:2020-1-16

    Catalog Summary Cyclic array Cyclic slice Cyclic map break continue goto switch Recommended reading Summary The previous articles shared array array, slice slice and map set. This article shared how to get the elements in the loop, and also reviewed the previous articles. The keywords used in this article are for, range, break, continue, goto, […]

  • A simple method of flattening JS array

    Time:2020-1-15

    Delayering In a word, array flattening refers to changing a multidimensional array (including nesting) into a one-dimensional array Flattening Es5 toString const arr = [1, 2, 3, [4, 5, [6, 7]]]; const flatten = arr.toString().split(‘,’); console.log(flatten); Advantages: simple, convenient, no impact on the original data Disadvantages: it’s better that array elements are all numbers or […]

  • The original state machine can also be used to brush leetcode?

    Time:2020-1-15

    What? State machine can also be used to brush leetcode? If you don’t know, come in and have a look! Title address: https://leetcode-cn.com/probl Title Description Give you an integer array nums, please find out and return the maximum sum of elements that can be divided by three integers.   Example 1: Input: nums = [3,6,5,1,8] […]

  • PHP class / object functions

    Time:2020-1-15

      PHP class / object functions are part of the core of PHP and can be used without installation. Function name describe __autoload Trying to load an undefined class class_alias Create an alias for a class class_exists Check if the class is defined get_called_class The name of the late static binding class get_class_methods Returns an […]

  • Leetcode weekly match for babies to understand – 170 – 2

    Time:2020-1-14

    1310. Exclusive or query of subarray Hi, everyone. I’m a pig. Welcome to the “baby can understand” series of leetcode weekly question solution. This is question 2 of issue 170, and also question 1310 in the list of questions – “sub array exclusive or query” Title Description There is a positive integer arrayarr, now I […]

  • Net finds the starting position of another array in one array (subscript starts from 0, return – 1 not found)

    Time:2020-1-12

    Question: If search appears sequentially in dist without requiring sequential occurrences, how should the code be modified? How to calculate the possibility of this match? Array search = [5,4,6], the starting position of dist = [1,5,5,4,3,4,5,6] is 1 (because the elements of the dist subscript {1,3,7} and the subscript {1,5,7} are equal to search = […]

  • Error analysis and solution of telescope and custom extended cache driver in laravel 5.8

    Time:2020-1-11

    previously on Because the filestore uses the9999999999In the end, the date overflows when using carbon processing, so I modified it to add a new oneApp\Extensions\Cache\FileStorefile <?php namespace App\Extensions\Cache; class FileStore extends \Illuminate\Cache\FileStore { protected function expiration($seconds) { $expiration = parent::expiration($seconds); return $expiration === 9999999999 ? 2147483600 : $expiration; } } And inApp\Providers\AppServiceProvider::boot()Extend the cache driver […]