Leetcode 202 question: two solutions to Happy Number

Title Description Determines whether a number n is a happy number. The definition of happy number is as follows: Starting with any positive integer, replace the number by the sum of the squares of its digits. Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those ...

Posted by redrabbit on Sat, 20 Nov 2021 21:35:38 -0800

Concurrent HashMap for Java Concurrent Programming

JDK1.7 First, the data is stored section by section, and then each section of data is equipped with a lock. When a thread occupies the lock to access one section of data, the data of other sections can also be accessed by other threads. ConcurrentHashMap is composed of Segment array structure and HashEntry array structure. Segment is a r ...

Posted by mika79 on Tue, 05 Oct 2021 13:46:31 -0700

HashMap related summary

This article is reproduced from: Implementation of HashMap in Jdk1.7 and 1.8 Essential for interview: Principles and differences of HashMap, Hashtable and ConcurrentHashMap 1, A glimpse of HashMap HashMap is a more widely used hash table implementation, and in most cases, it can carry out put and get operations under the condition of consta ...

Posted by brucensal on Wed, 22 Sep 2021 19:00:12 -0700