Tag:integer

  • Inverse Polish expression evaluation Python vs golang

    Time:2020-10-28

    Stack has great advantages in some matching scenarios and is very computer-friendly Question surface Calculate the value of inverse Polish (suffix expression), integer division only retains the integer partOperator contains only”+”,”-“,”*”and”/”The operands may be integers or other expressions [“20”, “10”, “+”, “30”, “*”] -> ((20 + 10) * 30) -> 900 [“40”, “130”, “50”, “/”, […]

  • Why did Python introduce Boolean types 18 years ago? And different from C, C + + and Java?

    Time:2020-10-26

    Why can Python support arbitrary truth value judgment? 》In this paper, we analyze the underlying implementation of Python in truth value judgment, and we can see that Python adopts a relatively broad attitude towards Boolean value. What is the official thinking about this? The following article is pep-285, written by Guido van Rossum, the father […]

  • Common operations of CSS

    Time:2020-10-22

    Get element width 1. Only inline styles can be obtained var ele = document.getElementById(‘element’); console.log ( ele.style.width ); // empty string console.log(ele.style.height); // ‘100px’ 2. Real time style MDN data var ele = document.getElementById(‘element’); console.log(window.getComputedStyle(ele).width); // ‘100px’ console.log(window.getComputedStyle(ele).height); // ‘100px’ 3、Element.currentStyle.width/height The function is the same as the second point. It only exists in the […]

  • C ා calculate days according to birth date / calculate x year x month x day string

    Time:2020-10-21

    public class TimeTool { //Calculate the whole number of days according to the date of birth private static int GetAgeByBirthdate(DateTime birthdate) { DateTime now = DateTime.Now; int age = now.Year – birthdate.Year; if (now.Month < birthdate.Month || (now.Month == birthdate.Month && now.Day < birthdate.Day)) { age–; } return age < 0 ? 0 : age; […]

  • C practical exercise topic 14 – factoring a positive integer into prime factors

    Time:2020-10-21

    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 […]

  • Summary of common functions in SQL Server

    Time:2020-10-20

    preface There are five kinds of functions in SQL Server: string function, date function, mathematical function, system function and aggregate function. String function –Common string functions 1. Charindex() — character index 2. Len () — length 3. Upper () — upper case 4. Ltrim () — left trim 5. Rtrim () — right trim 6. […]

  • Floating point correlation

    Time:2020-10-19

    Read some IEEE 754 implementation of floating-point arithmetic related articles IEEE 754 (IEEE 754-2019) Floating-point arithmetic Significand JavaScript floating point number trap and solution Basic field: on floating point numbers In depth analysis of floating point numbers What is the difference between quiet NaN and signaling NaN? Why is the most secure integer in JavaScript […]

  • Leetcode Weekly – 171 – 1

    Time:2020-10-18

    1317. Convert an integer to the sum of two nonzero integers Hi, everyone. I’m a pig. Welcome to the weekly leetcode quiz of the “baby can understand” series. This is the first question in issue 171 and 1317 in the list of topics – “converting an integer into the sum of two nonzero integers.” Title […]

  • Leetcode-7. Integer inversion

    Time:2020-10-12

    Leetcode-7. Integer inversion. Given a 32-bit signed integer, you need to reverse the number on each of the integers. Example 1: Input: 123 Output: 321 Example 2: Input: – 123 Output: – 321 Example 3: Input: 120 Output: 21 be careful:Assuming that the environment can only store the lower 32-bit signed integers, the value range […]

  • C ා learning 3

    Time:2020-10-10

    11   Two ways to run code pressF5Or click Run (right arrow) 12   In the process of programming, pay attention to write notes and appropriate names (notes–Easy to find the wrong name–Easy to find) 13   “//”Represents a comment symbol 14   The annotator plays two roles: cancellation and interpretation. First, the line of code will not be […]

  • Leetcode-8. String to integer (ATOI)

    Time:2020-10-10

    Leetcode-8. String conversion integer (ATOI). Please implement an ATOI function to convert a string to an integer. First, the function discards the useless beginning space character as needed until the first non space character is found. The following conversion rules are as follows: If the first non empty character is a positive or negative sign, […]

  • Python source code analysis – integer object in Python

    Time:2020-10-9

    1. Immutable pyintobject Python source analysis – object exploration we have a preliminary understanding of pyintobject. Objects in Python can be divided into fixed length and variable length. In addition, it can be divided into variable and immutable. Pyintobject is a fixed length and immutable object. Compared with other objects, it is the simplest and […]