Tag：positive integer

Time：2021225
Example: missing first positive number Source: leetcode Link:https://leetcodecn.com/probl… In situ hash Example: Missing first positive number Difficulty: hard describe To give you an unsorted integer array, please find the smallest positive integer that does not appear in it. Examples Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3, 4, – 1, 1] Output: 2 […]

Time：2021218
Java introduction classic examples (1) 1、 According to the age, the people who print out the current age are teenagers (below 18), young people (1928), middleaged (2955) and old people (above 56).Upper code `import java.util.Scanner; public class TextDemo { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println (“please enter the age […]

Time：202128
//Nonzero positive integers var num1 = /^+?[19][09]*$/; //Positive integer + 0 var num2 = /^d+$/; //Positive number var num3 = /^d+(?=.{0,1}d+$$)/; //Amount format var moneyReg = /(^[19]([09]+)?(.[09]{1,2})?$)(^(0){1}$)(^[09].[09]([09])?$)/; Keep updating

Time：2021113
For more articles, please pay attention to the official account of “BLOG of the sea”. Question: The sum of Squares Theorem is also called Lagrange theoremEvery positive integer can be expressed as the sum of squares of up to four positive integers.If 0 is included, it can be expressed as the sum of the squares […]

Time：202113
introduce Validate.Net With the help of Validate.js Net server data verification plugin is developed based on the idea of. Net, which can more conveniently and efficiently verify whether the attribute value in the entity is legal. There are many regular data checking rules in the builtin (length of the string, the maximum and minimum length […]

Time：20201220
Recently, I’m learning shell programming, through MOOCSLearn Shell Scripting with 360 ArchitectsSo I type out some examples in the course and record them here. We will continue to write some script examples to play with. Example 1:The variable string =’bigdata process framework is Hadoop, Hadoop is an open source program ‘. After executing the script, […]

Time：2020125
Theorem of linear equation Likeax+byThe smallest positive integer of is equal togcd(a,b)We use Euclidean algorithm to construct the appropriatexAndyIn other words, the equation will be describedax + by= gcd(a,b)Integer solutionxAndyMethods. Because of each numberax+bycovergcd(a,b)to be divisible by,ax + byThe smallest positive integer value of is exactlygcd(a,b)Solving equations by Euclidean algorithmax+by=gcd(a,b)For example, try to solve the […]

Time：2020121
343. Integer split Source: leetcode https://leetcodecn.com/problems/integerbreak subject Given a positive integer n, divide it into the sum of at least two positive integers and maximize the product of these integers. Returns the maximum product you can get. Example 1: Input: 2 Output: 1 Explanation: 2 = 1 + 1, 1 × 1 = 1. Example […]

Time：20201124
Nums is a positive array of integers and integers. Select any number from the [1, n] interval and add it to nums, so that any number in [1, n] interval can be represented by the sum of some numbers in nums. Please output the minimum number of digits that meet the above requirements. Example 1: […]

Time：20201119
text Today, when I was doing form validation, I found that,validateDefault validation rules: digits:trueYou must enter an integer Can only enter positive integers.Forms are always used in company projectsdigits:trueAnd no exception was found. Until today, negative numbers can be entered in that data. The test found that negative integers were entered, and the form verification […]

Time：20201110
Go has already implemented the conversion function of int > bin. Here I just implement the process logic. As for the principle, I assume that you all know it This case only considers the transformation of int > bin Contains the conversion of positive integer, negative integer, 0 package main import ( “fmt” “strconv” […]

Time：20201021
Title:Decompose a positive integer into prime factors. For example: input 90 and print 90 = 2 * 3 * 3 * 5. Program analysis:To decompose the prime factor of N, we should first find a minimum prime number k, and then complete it according to the following steps: (1) If the prime number is exactly […]