Tag:Complexity

  • The third largest number of leetcode

    Time:2022-7-1

    order This paper mainly studies the third largest number of leetcode subject Given a non empty array, returns the third largest number in the array. If it does not exist, the maximum number in the array is returned. The algorithm time complexity must be o (n). Example 1: Input: [3, 2, 1] Output: 1 Explanation: […]

  • Notes on basic number theory

    Time:2022-6-30

    CHANGE LOG 2021.12.6. Reconstruct the article, delete the linear sieve part, and modify some statements. 2022.3.15 secondary reconstruction article. 2022.3.23 three refactoring articles. On March 24, 2022, the reconstruction is completed, and Wilson’s theorem, power of prime number in factorial and combinatorial number, order and original root, higher-order residue and Lucas’ theorem are added. 0. […]

  • [comprehensive written test] difficulty 3/5, multiple solution LIS problem

    Time:2022-6-29

    Title Description This is from leetcode“354. Russian Doll envelope problem”, difficulty is“Difficulties”。 Give you a two-dimensional integer array envelopes, where envelopes[i] = [wi, hi] represents the width and height of the ith envelope. When the width and height of another envelope are larger than this envelope, this envelope can be put into another envelope, just […]

  • An understanding of in situ hash and time complexity

    Time:2022-6-28

    Don’t talk too much, just look at the topic 287 find duplicates: Given an array num containing N + 1 integers, whose numbers are between 1 and n (including 1 and N), it can be known that there is at least one duplicate integer. Suppose there is only one repeated integer, find the repeated number. […]

  • Leetcode question brushing record question 1: sum of two numbers

    Time:2022-6-24

    1. sum of two numbers Purpose: to find theSum of two numbers = target valueThe following are three implementation methods for the two – digit subscript value of realization Double layer for loop completion lookup Code part public int[] twoSum(int[] nums, int target) { int[] array = null; boolean flag = false; int i,j; //The […]

  • How do I make simple problems difficult?

    Time:2022-6-23

    Author: Xiao Yang Source: https://github.com/suukii/91-… Hello, I’m Lucifer. As we all know, I’m a small front-end (not). In fact, I’m Lucifer’s No. 1379 fan Mei observer. I’m a nano front-end. (don’t answer, don’t answer, don’t answer!!!) This is my first contribution, so I can say a few words about why I did the problem and […]

  • What are the design ideas for developing complex business systems

    Time:2022-6-20

    What are the design ideas for developing complex business systemsRecently, I participated in the design and development of some e-commerce business midrange and other complex business systems, combining DDD and midrange, I have some thoughts and experiences on architecture, which are recorded here. The core of the technical proposal is the following issues: Do what- […]

  • [selected sword fingers] from a macro point of view, “symmetric binary tree”

    Time:2022-6-19

    Title Description This is from niuke.com“JZ 58 symmetric binary tree”, difficulty is“Difficulties”。 Tag: “sword finger offer”, “binary tree”, “sequence traversal”, “iteration”, “recursion” Description: Please implement a function to judge whether a binary tree is symmetric. Note that if a binary tree is the same as the image of the binary tree, it is defined as […]

  • Algorithm search algorithm Python

    Time:2022-6-18

    Python search algorithm – sequential search, binary search, block search, hash table search, etc Search Algorithm-Sequential Search Binary Search Block Search Hash Table Search.etc. Sequential lookup Sequential search, also known as linear search, is one of the simplest search methods. It is suitable for the sequential storage structure and chain storage structure of linear tables. […]

  • Algorithm exercise 25: valid parentheses (leetcode 20)

    Time:2022-6-16

    subject Given a string s that only includes’ (‘,’) ‘,’ {‘,’}’,'[‘,’]’, judge whether the string is valid. Valid strings must meet: The left parenthesis must be closed with the same type of right parenthesis.The left parentheses must be closed in the correct order. ExampleInput: S = “()”Output: trueInput: S = “{[]}”Output: trueInput: S = “(]”Output: […]

  • JS find duplicate numbers in the array

    Time:2022-6-15

    All numbers in an array num of length n are in the range of 0 to n-1. Some numbers in the array are repeated, but I don’t know how many numbers are repeated, or how many times each number is repeated. Please find any duplicate number in the array. Example 1: Input: [2, 3, 1, […]

  • Let’s talk about how I brush the questions (the third bullet)

    Time:2022-6-15

    The addresses of the first two articles are here. Students who haven’t read them should read them first. Let’s talk about how I brush the questions (the first play) Let’s talk about how I brush the questions (the second play) This chapter may be the final chapter of this series. This time, I will talk […]