Tag:substring

  • Leetcode 336. Palindrome vs. Python

    Time:2020-11-22

    336. Palindrome is right Source: leetcode https://leetcode-cn.com/problems/palindrome-pairs subject Given a unique set of words, find all the different index pairs(i, j), so that the two words in the list,words[i] + words[j]Can be spliced into palindrome strings. Example 1: Input: [“ABCD”, “DCBA”, “LLS”, “s”, “sssll”] Output: [[0,1], [1,0], [3,2], [2,4]] Explanation: the palindrome strings that can […]

  • JS to convert numbers into comma separated formatted strings

    Time:2020-10-29

      //Note: the conversion of numbers to characters will lose the extra trailing 0 (‘123.010’123.01, ‘123.00’123) var NumberFormat = { //According to every 3-bit comma separation, string truncated string method toCommaFormat: function(number){ //If it is a number, it is converted to a string if(typeof number == ‘number’){ number = String(number) } var pointIndex = number.lastIndexOf […]

  • One person develops a product, applet from 0 to 1, Chapter 6 string

    Time:2020-10-29

    A string or string is a string of characters composed of numbers, letters, and underscores. First, it is a data type representing text in programming language. In programming, a string is a continuous sequence of symbols or values, such as a string of symbols (a string of characters) or a string of binary digits (a […]

  • Leetcode 647. Palindrome substring | Python

    Time:2020-10-28

    647. Palindrome substring Source: leetcode[ https://leetcode-cn.com/probl…](https://leetcode-cn.com/probl…) subject Given a string, your task is to calculate the number of palindrome substrings in the string. Substrings with different start or end positions, even if they are composed of the same character, are considered different substrings. Example 1: Input: “ABC” Output: 3 Explanation: three palindrome substrings: “a”, “B”, […]

  • 459. Repeated substrings (leetcodet question bank)

    Time:2020-10-25

    Source: leetcode Link: https://leetcode-cn.com/problems/repeated-substring-pattern Given a non empty string, judge whether it can be made up of its substring repeatedly. The given string contains only lowercase letters and is no longer than 10000. Example 1: Input: “ABAB” Output: true Explanation: the substring “ab” can be repeated twice.Example 2: Input: “ABA” Output: falseExample 3: Input: “abcabcacabcabc” […]

  • Leetcode-5. Longest palindrome substring

    Time:2020-10-25

    Leetcode-5. Longest palindrome substring. Given a string s, find the longest palindrome substring in S. You can assume that the maximum length of S is 1000. Example 1: Input: “babad” Output: “bab” Note: “ABA” is also a valid answer. Example 2: Input: “CBBD” Output: “BB” Source: leetcodeLink: https://leetcode-cn.com/problemset/all/The copyright belongs to the network. Commercial reprint […]

  • Let’s chew the algorithm together — the longest substring of non repeated characters

    Time:2020-10-22

    Longest substring without repeating characters This isLeetCodeThe third question is as follows: Given a string, please find out the length of the longest substring without repeating characters.Example 1:Input: “abcabcbbb”Output: 3Explanation: since the longest substring of an unrepeated character is “ABC”, its length is 3.Example 2:Input: “bbbbbbb”Output: 1Explanation: since the longest substring of an unrepeated character […]

  • Length of longest substring JavaScript solution to the longest substring of unrepeated characters

    Time:2020-10-20

    Leetcode question 3: Longest substring without repeating characters Subject address https://leetcode.com/problems… Title Description Given a string, please find out which does not contain repeated charactersLongest stringThe length of. Example 1: Input: “abcabcbbb” Output: 3 Explanation: since the longest substring of an unrepeated character is “ABC”, its length is 3. thinking 1. Take res as the […]

  • Leetcode 459. Duplicate substring | Python

    Time:2020-10-17

    459. Duplicate substring Source: leetcode https://leetcode-cn.com/problems/repeated-substring-pattern subject Given a non empty string, judge whether it can be made up of its substring repeatedly. The given string contains only lowercase letters and is no longer than 10000. Example 1: Input: “ABAB” Output: true Explanation: the substring “ab” can be repeated twice. Example 2: Input: “ABA” Output: […]

  • Notes on Python regular expression re module

    Time:2020-10-7

    brief introduction Regular expressionIs a pattern that can match text fragments. The simplest regular expression is a regular string that matches itself. For example, the regular expression ‘hello’ can match the string ‘hello’. It should be noted that regular expression is not a program, but a pattern used to process strings. If you want to […]

  • You can only use indexof?

    Time:2020-9-26

    We usually use the indexof method to determine whether a string contains a substring. If a substring is found, the position of the first occurrence of the substring is returned. If not found, – 1 is returned var name =’chuichui’ name.indexOf(‘chui’) // 0 name.indexOf(‘gg’) // -1 Today, I’d like to introduce some new methods in […]

  • Summary of JavaScript regular expressions

    Time:2020-9-14

    Why use regular expressions Regular expressions check, search and replace strings through text templates composed of ordinary characters and special characters. In JavaScript, it’s like this /^1\d{10}$/ The simple regular above is used to match phone numbersAs for the meaning of regular expression, it can be summarized by a sentence in master regular expression. “If […]