Tag:length

  • Redis – Chapter 9 – Dynamic strings

    Time:2021-2-24

    catalog summary SDS (dynamic string) The difference between SDS (dynamic string) and C language string 1. Overview The simple dynamic string SDS implemented by string type bottom layer is a string that can be modified. It uses pre allocation of redundant space to reduce the frequent allocation of memory. 2. SDS dynamic string Dynamic stringSo\0Is […]

  • Regular learning

    Time:2021-2-24

    Regular learning class Character class [] An object that conforms to certain characteristics/[ABC] / means to match one of ABC The reverse class [^] is enclosed in brackets^ Example: [^ A] is to match characters that are not a Range class [A-Z] It can match any character in A-Z Predefined Class Predefined characters: \D is […]

  • Jpg learning notes 5 (with complete code)

    Time:2021-2-23

    The fourth step of JPG compression is Huffman coding. The following is mainly about the Huffman coding of JPEG. The picture is quoted from “compressed image file formats, JPEG, PNG, GIF, XBM, BMP – John Miano” [1] 1. Huffman symbol of AC data For AC data, the first four bits to be encoded represent how […]

  • Calculate the length of return single byte and double byte character mixed string

    Time:2021-2-21

    Single byte length of string Calculate the length of return single byte and double byte character mixed string #!/usr/bin/env python3 Tips: in generating.xls, .xlsxWhen waiting for a file, you can use this function to calculate the byte length of the cell content and adjust the column width accordingly. This work adoptsCC agreementReprint must indicate the […]

  • Leetcode 209. The smallest subarray | Python

    Time:2021-2-21

    209. The smallest subarray Title Source: leetcode https://leetcode-cn.com/problems/minimum-size-subarray-sum subject Given an array containing n positive integers and a positive integer s, find out the smallest continuous subarray in the array which satisfies the sum ≥ s, and return its length. If there is no qualified continuous subarray, return 0. Example: Input: S = 7, nums […]

  • Angularjs form validation

    Time:2021-2-20

    When using angularjs for development, form filling is a very common requirement, and form verification is a headache. This paper makes a summary of this. The form used in the angular view is no longer the normal form in HTML, but an instruction encapsulated by angular. It can complete functions that ordinary form can’t realize, […]

  • How to get the longest substring of a string without repetition with PHP

    Time:2021-2-20

    The problem is to find the longest substring in the string that does not contain duplicate characters.The first kind <?php $string = “abcdaefaedkqatlmtx”; function test($string){ $len = strlen($string); $arr = []; for ($i = 1; $i <= $len; $i++) { for($j = 1; $j<= $len; $j++) { //Intercept from 0 to the maximum length, and […]

  • Go – array

    Time:2021-2-19

    summary An array is a sequence of elements of a specific type with a fixed length. An array can be composed of zero or more elements. Once declared, the length of the array is fixed and cannot be changed dynamically. Len() and cap() always return the same result.Declaration array   package main import ( “fmt” […]

  • Redis operation data common command detailed notes

    Time:2021-2-19

    Basic operation of redis Use help to query which commands are available Help @ string # query string type command Help @ hash # query hash command Help @ list # query list command Help @ set # query set command Help @ Zset # query Zset command Help @ cluster # query cluster command […]

  • Leetcode – duplicate number in array

    Time:2021-2-19

    Leetcode – duplicate number in array Blog description The information involved in this article comes from Internet collation and personal summary, which means personal learning and experience summary. If there is any infringement, please contact me to delete it. Thank you! explain Sword finger offer, 3 questions Duplicate number in array subject All numbers in […]

  • Algorithm several double pointer problems of leetcode

    Time:2021-2-16

    1. Search insertion position https://leetcode-cn.com/problems/search-insert-position/ class Solution { public int searchInsert(int[] nums, int target) { int left=0,right=nums.length-1; while(left<=right){ int mid=(left+right)/2; if(nums[mid]<target){ left=mid+1; }else if(nums[mid]>target){ right=mid-1; }else{ return mid; } } return left; } } 2. Search for 2D matrix https://leetcode-cn.com/problems/search-a-2d-matrix/ public boolean searchMatrix(int[][] matrix, int target) { if(matrix.length == 0) return false; int row = […]

  • Longest substring of non repeating character — sliding window method

    Time:2021-2-15

    1. Problem: given a string, find out the longest substring without repeating characters The longest unrepeated substring of ABC BC is ABC, and the length of ABC BC is 3   2. Method 1, violence law We can find out each substring, and then find the longest substring without repeating characters. The method is simple […]