Java basic 1
Array copy
1 | int[] array1, array2; |
我们通过new的方式,给array2在heap空间中开辟了新的数组空间,将array1数组的元素值一个个的copy进array2里
Swap array
1 | for(int i = 0; i < arr.length / 2; i++) |
1 | int[] array1, array2; |
我们通过new的方式,给array2在heap空间中开辟了新的数组空间,将array1数组的元素值一个个的copy进array2里
1 | for(int i = 0; i < arr.length / 2; i++) |
Requirements is not necessities
Requirement interact with tasks -> stps
i.e. Pacman video game involved requirement
Use case diagram is used to represent requirements
Activity Diagram: sequence of something, condition, loop
State diagram
In this class, we cover comprehensive knowledge. Information assurance is not only cyber security, it also comtains management, operation. Information quality is also part of info assurance.
算法基于一个事实,数组从任意位置劈开后,至少有一半是有序的
比如 [ 4 5 6 7 1 2 3] ,从 7 劈开,左边是 [ 4 5 6 7] 右边是 [ 7 1 2 3],左边是有序的。
我们可以先找到哪一段是有序的 (只要判断端点即可),然后看 target 在不在这一段里,如果在,那么就把另一半丢弃。如果不在,那么就把这一段丢弃。
In this project we will write a program that will “fire” a cannonball at a mid-air target and determine if the cannonball hits the target or not. Five variables needed for this calculation will be provided by the user. Our program will do minor input validation on this input and will output the outcome of your calculations. See the diagram below for an example of what we are calculating.
Singly LinkedList 1
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Example 1:
Input: n = 3
Output: [“((()))”,”(()())”,”(())()”,”()(())”,”()()()”]
Example 2:
Input: n = 1
Output: [“()”]
Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the first two lists.
Input: l1 = [1,2,4], l2 = [1,3,4]
Output: [1,1,2,3,4,4]
Example 2:
Input: l1 = [], l2 = []
Output: []
Example 3:
Input: l1 = [], l2 = [0]
Output: [0]