Record some questions asked to write in the interview and other favorite questions: the longest palindrome substring + the longest substring without repeated characters + the longest common substring

1. Question 5 of the longest palindrome substring force deduction Substring: substring must be continuous, which is different from the concept of subsequence Subsequence: Where the violent solution can be optimized: palindromes are judged only when the length of the substring is > the current maximum length, Is there anything that can be ...

Posted by bmyster on Tue, 21 Sep 2021 11:14:33 +0200

Explanation of application examples of breadth first search traversal (BFS) on two-dimensional arrays

Breadth first search traversal, also known as BFS, belongs to blind search method. It is one of the search algorithms of graph. The purpose is to systematically expand and check all nodes in the graph to find results. In other words, it does not consider the possible location of the result and searches the whole graph thoroughly until it finds ...

Posted by AffApprentice on Tue, 21 Sep 2021 01:26:55 +0200

leetcode writing diary

1. Where the dream begins - the sum of two numbers Given an integer array nums and an integer target value target, please find the two integers with and as the target value target in the array and return their array subscripts. You can assume that each input will correspond to only one answer. However, the same element in the array cannot be r ...

Posted by umguy on Mon, 20 Sep 2021 08:56:59 +0200

Xiao Wang's Leetcode question brushing Diary 3

3. Longest string without duplicate characters Method 1. Violence solution Generate substrings one by one See if it does not contain duplicate characters Method 2. Sliding window and optimization Do not repeat from a to C. when a repeats, the left pointer moves one bit to the right The right pointer moves one bit to the right Double pointer JA ...

Posted by parawizard on Mon, 20 Sep 2021 07:57:47 +0200

leetcode question brushing (array - binary search)

Binary search Binary search Given an n-element ordered (ascending) integer array nums and a target value target, write a function to search the target in nums. If the target value exists, return the subscript, otherwise return - 1. Example 1: Input: num = [- 1,0,3,5,9,12], target = 9, output: 4 Explanation: 9 appears in nums and the sub ...

Posted by EXiT on Sun, 19 Sep 2021 13:36:21 +0200

[algorithm LeetCode] 93. Restore IP address (backtracking; recursion)

93. Restore IP address LeetCode Released: 21:26:11, September 18, 2021 Problem description and examples Given a string containing only numbers to represent an IP address, return all valid IP addresses that may be obtained from s. You can return answers in any order. A valid IP address consists of exactly four integers (each integer is bet ...

Posted by timbuckthree on Sun, 19 Sep 2021 09:49:09 +0200

Data structure -- LeetCode special exercise Day14

43. String multiplication Give two nonnegative integers in string form   num1   and   Num2, return   num1   and   num2   Their products are also expressed in string form. Example 1: Input: num1 = "2", num2 = "3" Output: "6" Example   2: Input: num1 = "123", num ...

Posted by Fearpig on Sun, 19 Sep 2021 09:39:55 +0200

iOS LeetCode Palindrome Pair

Given a different set of words, find all the different index pairs (i, j) so that two words in the list, words[i] + words[j], can be stitched together into palindrome strings. Example 1: Input: words = ["abcd","dcba","lls","s","sssll"] Output:[[0,1],[1,0],[3,2],[2,4]] Interpretation: A spliceable palindrome string is ["dcbaabcd","abcddcba"," ...

Posted by Helios on Sat, 18 Sep 2021 22:04:25 +0200

leetcode brush record day002:189 and 217

189. Medium difficulty: the content refers to the official answer Think of the array as a ring connected end to end. Moving right is equivalent to rotating the ring Requirements: 1. Use the in-situ algorithm with spatial complexity O(1) to solve this problem; 2. There are at least three different ways to solve this problem Problem solving ide ...

Posted by dunnsearch on Fri, 17 Sep 2021 04:04:11 +0200

leetcode 239 maximum value of sliding window

preface Title: 239. Maximum value of sliding window Reference problem solution: Maximum value of sliding window - Official solution of force buckle Submit code Violent solution The simplest way is to solve it violently. The time complexity is O ( k ...

Posted by fxpepper on Sat, 11 Sep 2021 20:07:04 +0200