We found that the front-end and back-end projects of indexf are very frequent, no matter when we are working on them recently!
The meaning of indexOf: a given string matches the subscript of another string. If it matches, it returns the subscript. If it cannot match, it returns - 1. In fact, the principle is relatively simple ...
Posted by dbomb101 on Wed, 18 May 2022 20:40:42 +0300
Template, as the name suggests, is a fixed and standardized thing.
Template method pattern is a behavior design pattern. It defines an algorithm framework in superclass, allowing subclasses to rewrite specific steps of the algorithm without modifying the structure.
Suppose we are masters of a beverage shop, we need at leas ...
Posted by thekidscareya on Wed, 18 May 2022 14:59:35 +0300
Serialize and deserialize binary search trees
Serialization is the process of converting a data structure or object into a series of bits so that it can be stored in a file or memory buffer, or transmitted over a network connection link for later reconstruction in the same or another computer environment.
Design an algorithm ...
Posted by idire on Wed, 18 May 2022 13:53:33 +0300
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Now given an array of n integers, look for three numbers that add up to 0. Find all the different groups, each group consists of three numbers, and the sum of the t ...
Posted by BlueSkyIS on Wed, 18 May 2022 09:50:36 +0300
455 distribution of biscuits
Suppose you are a great parent and want to give your children some cookies. However, each child can only give one biscuit at most. For each child i, there is an appetite value gi, which is the minimum size of biscuits that can satisfy the children's appetite; And every cookie ...
Posted by mechamecha on Wed, 18 May 2022 06:40:12 +0300
This article mainly introduces the parallel search algorithm
1, Dynamic connectivity
Before introducing the algorithm, let's talk about what it is from and what problems it solves.
First look at the diagram to understand dynamic connectivity.
There are 10 points in the figure, one point pair is given at a time, for example (4, 3), which means ...
Posted by adhi_nugraha on Wed, 18 May 2022 06:16:46 +0300
1. The number of exchanges in each round of bubble sorting is equal to N - x, and X is the number of numbers that meet the following conditions: there is no larger number in front of this number We say that this number does not participate in the exchange in the current round of bubble sorting
2. The total number of rounds of bubble sort exc ...
Posted by moboter on Tue, 17 May 2022 23:30:21 +0300
String full permutation algorithm_ C # version_ Sword finger OFFER
Title Description Enter a string of length n and print out all the permutations of characters in the string. You can return this string array in any order. For example, if you input string ABC, all strings ABC,ACB,BAC,BCA,CBA and CAB that can be arranged b ...
Posted by saronoff on Tue, 17 May 2022 22:43:15 +0300
9. Number of palindromes
Algorithm idea: 1. First, judge whether x is a negative number. If it is a negative number, it directly returns false without conversion 2. Assign the palindrome number y according to the flashback until Y > = X. at this time, if x = = y | x = = Y / 10, it is the palindrome number, otherwise it ...
Posted by elwadhos on Tue, 17 May 2022 18:01:13 +0300
232. Implement queue with stack (simple)
Use the stack to implement the following operations of the queue:
push(x) -- put an element at the end of the queue.
pop() -- removes the element from the queue header.
peek() -- returns the element at the head of the queue.
empty() -- returns whether the queue is empty.
MyQueue queue = new MyQ ...
Posted by marian on Tue, 17 May 2022 14:29:27 +0300