I'll practice the algorithm with you (hash + linked list + double pointer)

hash 1. Sum of two numbers The idea is to save it in the hash table first, and then judge whether it exists again. Use target - class Solution { public int[] twoSum(int[] nums, int target) { Map<Integer,Integer> map = new HashMap<>(); for(int i = 0;i < nums.length;i++){ if(map. ...

Added by Jaguar on Mon, 07 Mar 2022 22:14:05 +0200

[daily question brushing 3.7] 10 algorithms + 10 interviews - ah V

In the new week, come on ~, make progress a little every day ~. Algorithm problem (Niuke network) 1. Fibonacci sequence The Fibonacci sequence starts with the third term and is equal to the sum of the first two terms. Code details: class Solution { public: int Fibonacci(int n) { vector<int> dp(n + 1); dp[ ...

Added by Ice on Mon, 07 Mar 2022 18:07:16 +0200

Programming topic + database topic summary

Programming problem prices = { 'AAPL': 191.88, 'GOOG': 1186.96, 'IBM': 149.24, 'ORCL': 48.44, 'ACN': 166.89, 'FB': 208.09, 'SYMC': 21.29 } 1. Some stock codes (keys) and prices (values) are saved in the dictionary. Use one line of code to find the stock with the highest price and output the stock code. (5 poin ...

Added by gregtel on Mon, 07 Mar 2022 14:20:06 +0200

"LeetCode" game 73 biweekly solution

6024. The number that appears most frequently immediately after the key in the array Code class Solution { public: int mostFrequent(vector<int>& nums, int key) { int n = nums.size(); int ans = 0; unordered_map<int, int> mp; for (int i = 0; i <= n - 2; i++) { /* Count the numbe ...

Added by MLJJ on Sun, 06 Mar 2022 17:01:08 +0200

Game 73 biweekly

Game 73 biweekly subject 6024. The number that appears most frequently immediately after the key in the array General idea of the topic Give you an integer array nums with subscript starting from 0, and give you an integer key, which has appeared in nums. Count the occurrence times of different integer targets that appear immediately after ...

Added by metalblend on Sun, 06 Mar 2022 11:47:09 +0200

Learning Java multithreading is enough

1, Threads and processes In programs that do not use multithreading, the program has only one main thread, and our program is top-down according to the code. In multithreaded programs, other threads run simultaneously with the main thread. As shown in the figure: Next, we introduce related concepts Speaking of process, we have to say pro ...

Added by benmay.org on Sun, 06 Mar 2022 09:04:53 +0200

LeetCode-149. Maximum number of points on a line

Topic source 149. Maximum number of points on a line Title details 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. Example 1: Input: points = [[1,1],[2,2],[3,3]] Output: 3 Example 2: Input: points = [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]] Output: 4 ...

Added by gavin1996 on Sun, 06 Mar 2022 04:54:42 +0200

[title record] - ICPC Dalian 2016

Title set address ICPC Dalian 2016 A - wresting match Title address A - Wrestling Match There are n athletes and m games. It is known that x are good athletes and y are bad athletes. Each game is a good athlete and a bad athlete. Ask whether all athletes can be divided into good athletes or bad athletes according to the known information. ...

Added by conquest on Sun, 06 Mar 2022 04:18:26 +0200

Prepare for the Blue Bridge Cup--High Precision Algorithms for Multiplication and Division

💟 Author's introduction: Hello, my name is Ceylan_, Can call me CC ❣️ * 📝 Personal home page: Ceylan_ Blog 🏆 Blogger information: ordinary freshmen have extraordinary dreams Columns Prepare for the Blue Bridge Cup    Deduct one question per dayPTA Sky Ladder Race ⚡ I hope you can support me a lot 😘 Progress Together~ ❤️ 🌈 If it helps ...

Added by nickiehow on Sat, 05 Mar 2022 19:22:41 +0200

LeetCode-53 - Maximum subarray sum - Simple (greedy / divide and conquer)

preface In fact, the official also provides a method of dynamic planning. I'll make it up when I'm free (cry) One topic Give you an integer array nums. Please find a continuous sub array with the largest sum (the sub array contains at least one element) and return its maximum sum. A subarray is a contiguous part of an array. II. Examples an ...

Added by helbom on Sat, 05 Mar 2022 15:27:47 +0200