Digital statistics DP (338. Counting problem)
Given two integers ∼ a ∼ and ∼ b, find the number of occurrences of 0 ∼ 9 in all numbers between ∼ a ∼ and ∼ b.
For example, if a=1024 and b=1032, the total number of , 9 , between , a , and , b , is as follows:
1024 1025 1026 1027 1028 1029 1030 1031 1032
Among ...
Posted by artisticre on Fri, 20 May 2022 22:49:00 +0300
foreword
This is the 20th day of the May training camp. Today's training content is binary search tree.
Problem solving report
1. Force buckle 700
Original title link
700. Searching in Binary Search Trees
Topic overview
Given a binary search tree (BST) root node root and an integer value val.
You need to find the node whose node val ...
Posted by Duncan85 on Fri, 20 May 2022 22:40:36 +0300
Find – collision pointer
Give an integer array nums and return the index values I and j of the two numbers in the array, so that nums[i] + nums[j] is equal to a given target value, and the two indexes cannot be equal.
For example: num = [2,7,11,15], target = 9
Return [0,1]
Idea:
Whether the start array is in order;
Is the index calculate ...
Posted by steven21 on Fri, 20 May 2022 16:49:37 +0300
There are two prisons in S City, holding a total of N criminals, numbered 1~N respectively.
Naturally, the relationship between them is also extremely disharmonious.
Many criminals have even accumulated grievances for a long time. If the objective conditions are met, conflicts may break out at any time.
We use "resentment value" (a po ...
Posted by hame22 on Fri, 20 May 2022 15:31:44 +0300
Find actual combat
Case 1: sum of two numbers
Given an integer array nums and a target value target, please find the two integers with and as the target value 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 the array cannot be used twice.
Example:
G ...
Posted by onewaylife on Fri, 20 May 2022 12:03:25 +0300
Sword finger Offer - java version
JZ01
In a two-dimensional array (each one-dimensional array has the same length), each row is sorted in ascending order from left to right, and each column is sorted in ascending order from top to bottom. Please complete a function, input such a two-dimensional array and an integer, and judge whether the arra ...
Posted by hagman on Fri, 20 May 2022 06:37:47 +0300
day22_0519
choice question
1: simply select the best time O(n^2) average time O(n^2) worst time O(n^2) 2: Directly insert the best time O(n) average time O(n^2) worst time O(n^2) 3: Bubble sort best time O(n) average time O(n^2) worst time O(n^2) 4: Hill sort ^ best time ^ O(n) average time O(logn) worst time ^ O(n^s) 1 < s < 2 ...
Posted by QuietWhistler on Fri, 20 May 2022 01:49:27 +0300
LeetCode algorithm
Most bogey, hope to do a series of articles to record the process of brushing algorithm.
At present, it is mainly based on LeetCode https://leetcode-cn.com/circle/article/48kq9d/ The module of this post will brush the questions.
The content is mainly the summary of the landlord in the post, as well as some personal experience ...
Posted by shak123 on Thu, 19 May 2022 20:46:21 +0300
0. Always say
It's time to pick up your studies that have been neglected for so long. Today is 2022-05-18. Brush at least two questions every day. I've written the first few times and directly abbreviated them.
1. 1. Sum of two numbers
1. Title Description
2. Topic analysis
Traverse to find two numbers with mapping relationship, so y ...
Posted by php3ch0 on Thu, 19 May 2022 01:06:23 +0300