149. Maximum number of points on a line
Give you an array of points, where points[i] = [xi, yi] represents a point on the X-Y plane. Find the maximum number of points on the same line.
Input: points = [[1,1],[2,2],[3,3]]
Input: points = [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]
Added by gavin1996 on Sun, 06 Mar 2022 04:54:42 +0200
Symbol table is set and map. In c + +, there are map and set based on red black tree and unordered based on hash function_ map，unordered_set.
The symbol table used in this code is my own implementation, according to the implementation method of algorithm 4.
The blacklist is to filter out what is on the list and ...
Added by jofield on Sat, 05 Mar 2022 09:54:29 +0200
jdk1.7 -: it is composed of array + linked list. The array is the main body. The linked list mainly exists to solve hash conflicts (i.e. the array index values calculated through the key are the same) (the "zipper method" solves conflicts).
jdk1.8 +: it is composed of array + linked list + red black tree. There are great changes in r ...
Added by simpjd on Thu, 24 Feb 2022 04:51:51 +0200
students, today we will deeply analyze the source code of HashMap. I believe many students will be asked about the source code during the interview. Which one is the most asked? Most students will definitely think of HashMap. Through the study of this article, you will be able to easily master the source code knowledge of HashMa ...
Added by KindredHyperion on Wed, 23 Feb 2022 10:33:19 +0200
The most elegant way to write a value in a Map that increases or decreases automatically or re operates a value without calling get() and put()
I believe you can always meet such needs in the process of development: query a key value in the Map, add one if there is one, and put the new key value as 1 if there is no one (or perform other operat ...
As for thread safety, the put method can expose the problem of thread safety. When two different hashcode s get the same index through hash calculation, they should form a linked list. However, if multiple threads are placed in the same index, it may be overwritten, which is when judging whether the table[index] is empty.
No more nons ...
Added by fastfingertips on Sat, 19 Feb 2022 01:27:26 +0200
Before reading this article, it is recommended to read the blogger's article on HashMap: HashMap source code analysis + interview questions
HashSet source code analysis
1, Basic introduction
The underlying implementation is based on HashMap, so it is not guaranteed to iterate according to the insertion order or other order The time-con ...
Added by finkrattaz on Fri, 18 Feb 2022 21:28:44 +0200
HashMap allows null keys and values.
Hashtable does not allow null values or null keys. NullPointerException will be thrown.
The time complexity of get put is constant.
HashMap has two parameters that affect its performance: initial capacity, initial capacity and load factor. Capacity refers to the number of bucket s, that is, the l ...
Added by svan_rv on Fri, 18 Feb 2022 03:23:56 +0200
Learning points of Java and big data development (under continuous update...)
Reference from HashMap? ConcurrentHashMap? I believe no one can stop you after reading this article!
Key and value such as Map are very classic structures in software development. They are often used to store data in memory.
This article mainl ...
Added by jmaccs64 on Thu, 17 Feb 2022 16:57:12 +0200
Write in front: it took a day to sort out the data collected by small codewords. It's helpful for you. One key three times in a row. Ha, thank you!!
HashMap is often encountered in our daily development. The source code and underlying principle of HashMap must be asked in the interview. Therefore, we should master it, which is ...
Added by vweston on Thu, 17 Feb 2022 16:03:07 +0200