15 sum of three numbers (July 9, 2021)
15. Sum of three
Link: https://leetcode-cn.com/problems/3sum/
See the link for the title description.
Solution 1: triple cycle + HasH de duplication
I couldn't think of any good idea, so I started it in a stupid way, compared it with three cycles, saved the existing results with a HasH, and made the first two numbers of the results as ...
Added by mattcairns on Sat, 22 Jan 2022 08:15:03 +0200
Review of writing test questions
1. (Leetcode665) non decreasing column: given an integer array of length N, your task is to judge whether the array can become a non decreasing column when at most one element is changed. We define a non decreasing column as follows: for all I (1 < = I < n) in the array, array [i] < = array [i + 1] is satisfied
Idea:
Judge whether to ...
Added by welsh_sponger on Sat, 22 Jan 2022 01:23:48 +0200
Acronyms -- use arrays as hash tables
1. Valid Letter Words
Given two strings s and t, write a function to determine whether t is an alphabetic ectopic word of s.
Note: if each character in S and t occurs the same number of times, s and T are called alphabetic words. Valid Letter ectopic words
Idea: 1. Create an array with a size of 26 to record the number of occurr ...
Added by eduard77 on Fri, 21 Jan 2022 20:54:18 +0200
Li Kou 242 effective letter ectopic words
Title Link
https://leetcode-cn.com/problems/valid-anagram/
Source code github address
https://github.com/YIMEng-0/DataStructure
1. Title Requirements
Given two strings s and t, write a function to determine whether t is an alphabetic ectopic word of s.
Concept of acronym: Note: if each character in S and t occurs the same nu ...
Added by dpearcepng on Thu, 20 Jan 2022 21:12:30 +0200
Force deduction brush question - array 5
Two dimensional array transformation
Remodeling matrix
Topic introduction Train of thought analysis
This question can be written according to the meaning of the question, but before traversing the two-dimensional array, judge whether the given r and c are reasonable in advance. If not, just return directly.When the product of r and ...
Added by hongco on Thu, 20 Jan 2022 20:34:34 +0200
Leetcode interview question 17.10 Main elements (enumeration method) (hash table method) (midpoint method) (molar voting method)
Here is the title: https://leetcode-cn.com/problems/find-majority-element-lcci/
Topic analysis:
Be sure to see the problem clearly. In the problem, please design a solution with time complexity of O(N) and space complexity of O(1).
Train of thought analysis:
This problem is not difficult to understand. Find the element with the most occurre ...
Added by rushenas on Thu, 20 Jan 2022 15:45:52 +0200
LeetCode-208. Implement Trie (prefix tree)
Topic source
208. Implement Trie (prefix tree)
Title details
Trie (pronounced like "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in string data sets. This data structure has many application scenarios, such as automatic completion and spell checking.
Please implement the Trie class:
Trie() ...
Added by Josepheuan on Thu, 20 Jan 2022 11:02:00 +0200
Sword finger offer tree 2m Stack & queue 2e1m1h-10
JZ86 (m) finds the nearest common ancestor of two nodes in the binary tree
Simple idea: first dfs, record the path, find the corresponding value, and then return; Then compare the two paths (arrays) obtained by dfs and find the last same value from scratch;Complexity: time
O
...
Added by sturoy on Thu, 20 Jan 2022 05:45:08 +0200
Li Kou brush question diary [January 19, 2022]
Li Kou brush question diary [January 19, 2022]
1. 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 th ...
Added by webguync on Thu, 20 Jan 2022 03:10:22 +0200
leetcode15. Sum of three (medium)
Give you an array num containing n integers. Judge whether there are three elements a, b and c in num, so that a + b + c = 0? Please find all triples with sum 0 and no repetition.
Note: the answer cannot contain duplicate triples.
Example 1: Input: num = [- 1,0,1,2, - 1, - 4] Output: [- 1, - 1,2], [- 1,0,1]]
Example 2: Input: num = [] Output ...
Added by XtacY on Wed, 19 Jan 2022 21:55:24 +0200