Tag：leetcode

Time：2020218
Summary I think my algorithm thinking ability is a little weak, so I will basically do 12 to leetcode algorithm problems every night. In the past two days, we have encountered a problem of permutation – next permutation. Then I went to search for the algorithm to generate the permutation. Here is a summary. algorithm […]

Time：2020216
D118 350. Intersection of Two Arrays II Title Link 350. Intersection of Two Arrays II Title Analysis Returns the intersection of a given array. thinking Start from the larger array to find out whether the element exists in another array and whether the number is less than or equal to the current array. If yes, […]

Time：2020131
Map introduction Map is a kind of C + +Key value pairContainer, the point is that the data appears in pairs in the map, and the corresponding value can be quickly found by key, that is, key. Using map When you program yourself, you need to add the following header file before the code to […]

Time：2020121
Abstract:Interview brush guide. How to debug LeetCode code in VS Code By Neo CS Fundebug is reprinted by authorization, and the copyright belongs to the original author. Recently, many small partners have been asked for help. I want to know how to debug LeetCode code in VS Code. Generally speaking, in order to debug the […]

Time：2020112
D49 821. Shortest Distance to a Character Title Link 821. Shortest Distance to a Character Title Analysis Given a stringsAnd a characterc。 Returns the distance between each character in the string and the given charactercThe shortest distance. thinking First find the characters with array keyCIn stringSLocation in. If the current traversal position is the next […]

Time：2020111
D50 933. Number of Recent Calls Title Link 933. Number of Recent Calls Title Analysis I was blinded by the truth of the subject. Returns the number of pings (including the current pings) since 3000 milliseconds. transferpingFunction, the arguments passed intIs the number of milliseconds currently Ping. thinking In fact, the number of pings in […]

Time：2020110
D51 136. Single Number Title Link 136. Single Number Title Analysis Returns an element in a given array that appears only once. thinking Count the number of times the element appears with array ﹣ count ﹣ values. Use array search to return the element with occurrence number of 1. Final code <?php class Solution { […]

Time：202019
D52 496. Next Greater Element I Title Link 496. Next Greater Element I Title Analysis Given two arrays, the inner elements are not repeated. Array 1 is a subset of array 2, which returns the largest element to the right of each element in array 1 in the corresponding position of array 2. thinking It […]

Time：202019
subject Given a perfect binary tree, all its leaf nodes are in the same layer, and each parent node has two child nodes. Binary tree is defined as follows: struct Node { int val; Node *left; Node *right; Node *next;}Fill each of its next pointers so that the pointer points to its next right node. […]

Time：202018
Easy 020 Valid Parentheses Description: “()” “[]” {} “three kinds of bracket matching problems to determine whether the parameter string meets the matching requirementsFor example: ‘({[]})’ true ‘[{})’ falseNote: empty string is true My Solution: The problem of bracket matching is a typical application of stack. When encountering the left bracket, when entering the stack, […]

Time：202017
Subject requirements Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return 1.0. Example: Given a / b = 2.0, b / c […]

Time：202016
Subject requirements Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. Could you do it without extra space and in O(n) runtime? You may assume […]