Tag:leetcode

  • PHP algorithm Title: 448 find all the missing numbers in the array

    Time:2020-7-20

    448. Find all the missing numbers in the array Title Link: https://leetcode-cn.com/probl… Difficulty: simple Title Description Given an integer array in the range of 1 ≤ a [i] ≤ n (n = array size), some elements in the array appear twice, others appear only once. Find all numbers in the range [1, n] that do […]

  • Algorithm summary for generating permutations

    Time:2020-2-18

    Summary I think my algorithm thinking ability is a little weak, so I will basically do 1-2 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 […]

  • Leetcode PHP solution — d118 350. Intersection of two arrays II

    Time:2020-2-16

    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, […]

  • Common usage of C + + map in leetcode

    Time:2020-1-31

    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 […]

  • How to debug LeetCode code in VS Code?

    Time:2020-1-21

    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 […]

  • Leetcode PHP problem solving — d49 821. Short distance to a character

    Time:2020-1-12

    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 […]

  • Leetcode PHP solution — D50 933. Number of recent calls

    Time:2020-1-11

    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 […]

  • Leetcode PHP solution — D51 136. Single number

    Time:2020-1-10

    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 { […]

  • Leetcode PHP solution — D52 496. Next greater element I

    Time:2020-1-9

    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 […]

  • [leetcode] 116. Fill in sibling nodes of the same layer

    Time:2020-1-9

    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. […]

  • 【LeetCode Easy】020 Valid Parentheses

    Time:2020-1-8

    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, […]

  • leetcode399. Evaluate Division

    Time:2020-1-7

    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 […]