Article directory Preface 1. Introduction to data types 2. Storage of integers in memory 2.1 Original code, complement code, complement code 2.2 Little-endian storage and big-endian storage 2.3 Signed data and unsigned data 2.4 Exercise: Determine whether the storage mode of the current machine is big endian or little endian? 3. Reading of integer data […]
Tag: integer
[Question Solving] Integer is assigned a constant 1 in auto-boxing, why does == determine true and false (JDK source code, internal buffer)
Table of Contents answer: 1.low and high values in the if statement 2. What is returned in the if block 3.Outside the if statement block Summarize Question code JDK source code related source code The problem comes from the Integer exercise during the lecture The first reaction at that time was false true true There […]
[Python Experimental Design] BMI calculation / Integer division / Monte Carlo approximation of pi / Enumeration method to verify 6174 conjecture / Joseph ring / Rotary lottery / Ability value / Caesar encryption
Table of Contents 1. [Calculate BMI Index] 2. [Input integers to divide] 3. [Monte Carlo method to calculate the approximate value of pi] 4. [Use enumeration method to verify 6174 conjecture] 5. [Simulated counting game (Joseph Ring Problem)] 6. [Simulated Roulette Lottery Game] 7. [Ability Value Accumulation] 8. [Principle and Implementation of Caesar Encryption Algorithm] […]
Application of C++ prefix sum algorithm: taking down the sum of integer pairs Principle source code test case
Basic knowledge points involved in this article C++ algorithm: principles, source code and test cases of prefix sum, prefix product, prefix XOR including course videos Title Sum of integer pairs down Given an integer array nums, please return the sum of the results of floor(nums[i] / nums[j]) for all subscript pairs 0 vSum.emplace_back(n + vSum.back()); […]
Application of simple monotonic stack, suspension method—maximum submatrix, integer division (regular + block boundary)
The use of simple monotonic stack Niuke’s one-stop solution is the best barrier Question: There are n mountains with a height of ai. The soldiers on the mountain can supervise each other if and only if max(ai + 1…aj-1)
Driver development 3 ioctl function usage + 3 examples (the third parameter is not passed, the third parameter is an integer, the third parameter is an address)
Development board:stm32mp157aaa (Cortex-A7*2 + Cortex-M4*1) Development environment:vscode, serial port tools, ubuntu 18.04 vscode compilation process: 1 The significance of introducing the ioctl function In the Linux operating system, data reading and writing and reading and writing function selection are intentionally left to different functions to complete. Just let the read/write function only read and write […]
Edabit Algorithm Add Two Large IntegersRecursion: Sum of Two Numbers (With A Twist!)
Recursion: Sum of Two Numbers (With A Twist!) Instructions This is an “expert” challenge!!! Why is a sum of two numbers an “expert” challenge!!! Well, the numbers can have 1000 digits or even beyond such count… So, what’s the twist? You have to do the summation as if you’re doing it manually on a piece […]
Solving AttributeError: module numpy has no attribute integer
Table of Contents Solving AttributeError: module ‘numpy’ has no attribute ‘integer’ wrong reason Solution 1. Check numpy version 2. Modify the code 3. Rerun the code Summarize int_ intc Solve AttributeError: module ‘numpy’ has no attribute ‘integer’ When we use the integer type in the numpy library, we sometimes encounter the following error message: ??AttributeError: […]
Solve the problem that Index must be a positive integer or logical encountered in Matlab
Table of Contents Solve the “Index must be a positive integer or logical” error encountered in Matlab Reason for error Solution Check if index is an integer or logical value Check if index is out of bounds Check for empty index array Summarize Solve the “Index must be a positive integer or logical” error encountered […]
A sudden thought about “How many times does the number 9 appear in all integers from 1 to 100?”
1. Title Write a program to count how many times the number 9 occurs among all the integers from 1 to 100. 2. Normal algorithm For this question, you only need to use a for loop to traverse all the numbers from 1 to 100. For each number, use modulo 10 to determine whether the […]