Tag:array
-
Let you understand the main points of typescript in vernacular (II)
Array scenario 5 There are all kinds of things in my numbers. What should I do? As the old rule, first write your data according to JS. (Union type) To analyze the data, just add the colon of arr Before you finish typing the code, vscode has started to remind you how to write it. […]
-
Difference between JavaScript expansion operator and residual operator
JavaScript uses the symbol three dots (…) As residual operator and expansion operator, but the two operators are different. The main difference is that the remainder operator puts the rest of some specific values provided by the user into a JavaScript array, while the expansion operator expands the iteratable object into a single element. For […]
-
Chapter XIII structure and other data types
13.1 example question: create a Book Catalog Procedure list 14.1 #define _CRT_SECURE_NO_WARNINGS 1 //June 5, 2022 12:46:05 //book. C– book catalogue containing only one book #include #Define maxitl 41 // maximum length of book title +1 #Define maxautl 31 // maximum length of author name +1 Struct book // structure template: marked as book { […]
-
What are the differences between JS array built-in traversal methods?
forEach()The (ES6) method executes the given function once for each element of the array. 1. how many elements are there in the array? The callback in this method will be executed several times 2. the first parameter is the element in the array, the second parameter is the index of the element in the array, […]
-
Analysis of the core idea of webpack
Analysis of the core idea of webpack We have been thinking about writing a construction tool, but before that, let’s try to sort out the concept of webpack. After all, it is a stone of the mountain that can be used to attack jade, which helps us figure out how to design our own projects. […]
-
Chapter 05 – array — learning notes for introduction to c++ Basics
5 array 5.1 general An array is a collection containing data elements of the same type Feature 1: each data element in the array is the same data type Feature 2: arrays are composed of contiguous memory locations 5.2 one dimensional array 5.2.1 definition method of one-dimensional array There are three ways to define a […]
-
Array methods commonly used in front-end development (I)
Array methods commonly used in front-end development (I) JavaScript provides a large number of different methods for processing arrays. Here, I will take a few minutes to introduce some common array methods. 1、Array.map() The map () method returns a new array. The elements in the array do not have the value processed by the function […]
-
C\expression collection
1: General overview 1: Get attribute value: 2: Call method 3: Dynamic tectonic conditions 4: Create object 5:Switch Case 6: Try catch and capture exception information and output 7:if esle 8:+ / += 9: + = […]
-
7. C language Yanghui triangle (two methods)
We have known Yanghui triangle since junior high school. Now, let’s use C language to display it on the computer. In junior high school, we knew that the numbers of the two waists of Yanghui triangle were 1, and the numbers of other positions were the sum of the two numbers on the top. This […]
-
JS — array method & higher order function
1、 Basic array usage 1. Create array method (1) Use the new keyword Let stu1 = new array (‘zhang San ‘,’ Li Si ‘,’ Wang Wu ‘,’ Zhao Liu ‘); (2) Use brackets [], recommended Let stu2 = [‘Zhang San’, ‘Li Si’, ‘Wang Wu’, ‘Zhao Liu’, ‘Li Lei’]; (3) Use array of() let stu3 = […]
-
Let you understand the main points of typescript in vernacular (III)
Three object scene General objects (method not included) As before, we should not directly restrict what is in the object. We should always have data before type restrictions. At this point, go back and add the type constraint. (an error type is specifically demonstrated) There is another problem. Here we use semicolons to separate the […]
-
Disembarkation algorithm I leetcode weekly contest 222 problem solving Report
No.1 maximum number of units on the truck Problem solving ideas Priority should be given to the use of boxes with large capacity. Code presentation class Solution { public int maximumUnits(int[][] boxTypes, int truckSize) { Arrays.sort(boxTypes, (a, b) -> (b[1] – a[1])); int res = 0; for (var box : boxTypes) { int cnt = […]