• ## Disembarkation algorithm | leetcode weekly contest problem solving report for game 256

Time：2021-10-22

[No.1 minimum difference of student scores] Problem solving ideas Sort, and then enumerate every successive k elements. Code display class Solution { public int minimumDifference(int[] nums, int k) { if (nums.length < 2 || k == 1) { return 0; } Arrays.sort(nums); int res = nums[k – 1] – nums; for (int i = k; […]

• ## Disembarkation algorithm leetcode weekly contest 257 problem solving Report

Time：2021-10-17

[No.1 statistical special Quad] Problem solving ideasCheck in questions, just enumerate. Code display class Solution { public int countQuadruplets(int[] nums) { int n = nums.length; int res = 0; for (int a = 0; a < n; a++) { for (int b = a + 1; b < n; b++) { for (int c = […]

• ## Leetcode weekly contest 258 problem solving Report

Time：2021-10-15

[No.1 reverse word prefix] Problem solving ideas Check in question. Code display class Solution { public String reversePrefix(String word, char ch) { int index = word.indexOf(ch); return new StringBuffer(word.substring(0, index + 1)).reverse().toString() + word.substring(index + 1); } } [No.2 number of groups of interchangeable rectangles] Problem solving ideas Classify the rectangles according to the aspect […]

• ## Disembarkation algorithm leetcode weekly contest 259 problem solving Report

Time：2021-10-12

[No.1 variable value after operation] Problem solving ideasCheck in question. Code display class Solution { public int finalValueAfterOperations(String[] operations) { int v = 0; for (String op : operations) { if (op.contains(“++”)) { v++; } else { v–; } } return v; }} [No.2 sum of array values] Problem solving ideasThe beauty value of the […]

• ## Disembarkation algorithm leetcode weekly contest 260 problem solving Report

Time：2021-10-11

[maximum difference between No.1 increment elements] Problem solving ideasThe traversal array maintains the global minimum value. If the current value is large, it is a reasonable answer. The traversal process can take the maximum reasonable answer. Code display public class Solution { public int maximumDifference(int[] nums) { if (nums == null || nums.length == 0) […]

• ## The way of enhancing the current situation and evolution of Gaode’s geographical interest points

Time：2021-8-24

1. Introduction People will see many points of interest (POI) on Gaode map, such as restaurants, supermarkets, scenic spots, hotels, stations, parking lots, etc. The evaluation dimensions of POI data include current situation, accuracy, completeness and richness. Among them, the current situation is the extent to which the geospatial information provided by the map reflects […]

• ## Greedy algorithm – Maximum suborder sum

Time：2021-8-4

Problem description Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Link: https://leetcode-cn.com/probl… Problem solving ideas Loop through the array to determine whether each element can be added to a subsequence that may become the largest subsequence sum.The judgment condition is that […]

• ## The minimum number of Fibonacci numbers with sum K

Time：2021-7-8

To give you the number k, please return the minimum number of Fibonacci numbers for K. each Fibonacci number can be used multiple times. Fibonacci numbers are defined as: F1 = 1 F2 = 1 FN = fn-1 + fn-2, where n > 2. The data guarantee that the feasible solution can be found for […]

• ## Codeforces Good Bye 2020 A-D

Time：2021-7-6

A – Bovine Dilemma Solution: think that the problem said is a triangle, and there is a certain point (0,1), so here only need to find two points can form a triangle, and these two points are on the X axis, so you can know (0,1) to X axis is high, X axis two points […]

• ## [leetcode] 268. Missing number

Time：2021-7-4

Given a sequence containing N numbers in 0, 1, 2,…, N, find the number in 0.. n that does not appear in the sequence. Example 1: Input: [3,0,1] Output: 2 Example 2: Input: [9,6,4,2,3,5,7,0,1] Output: 8 explain:Your algorithm should have linear time complexity. Can you just use the extra constant space? Solution code:

• ## Front end algorithm leetcode 56 – I. the number of numbers in the array

Time：2021-7-2

In an integer array nums, except for two numbers, other numbers appear twice. Please write a program to find these two numbers that only appear once. The time complexity is O (n) and the space complexity is O (1). Example 1: Input: nums = [4,1,4,6] Output: [1,6] or [6,1] Example 2: Input: nums = [1,2,10,4,1,4,3,3] […]

• ## [leetcode] 57 – II. Sequence of continuous positive numbers with sum s

Time：2021-6-21

1. Input a positive integer target and output all the continuous positive integer sequences (at least two numbers) whose sum is target. The numbers in the sequence are arranged from small to large, and different sequences are arranged from small to large according to the first number. Example 1: Input: target = 9 Output: [[2,3,4], […]