文档添加关于字符串、字节和void数据类型的说明
在NumPy文档中,常规介绍部分现在包含了关于字符串、字节和void数据类型的信息,以及现有的数值类型。
This commit is contained in:
parent
b96497213a
commit
63ca326724
2
pom.xml
2
pom.xml
@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
111
src/main/java/cn/whaifree/interview/random/StackForQueue.java
Normal file
111
src/main/java/cn/whaifree/interview/random/StackForQueue.java
Normal file
@ -0,0 +1,111 @@
|
||||
package cn.whaifree.interview.random;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
|
||||
public class StackForQueue {
|
||||
|
||||
public static void main(String[] args) {
|
||||
MyStack myStack = new MyStack();
|
||||
myStack.push(1);
|
||||
myStack.push(2);
|
||||
myStack.push(3);
|
||||
System.out.println(myStack.peek());
|
||||
System.out.println(myStack.pop());
|
||||
System.out.println(myStack.size());
|
||||
while (myStack.size()!=0){
|
||||
System.out.println(myStack.pop());
|
||||
}
|
||||
}
|
||||
|
||||
static class MyStack{
|
||||
Queue<Integer> queue1 = new ArrayDeque<>();
|
||||
Queue<Integer> queue2 = new ArrayDeque<>();
|
||||
|
||||
void push(int x){
|
||||
queue1.add(x);
|
||||
}
|
||||
|
||||
int peek() {
|
||||
if (queue1.isEmpty()) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
while (queue1.size()>1){
|
||||
queue2.add(queue1.poll());
|
||||
}
|
||||
Integer poll = queue1.poll();
|
||||
queue2.add(poll);
|
||||
while (!queue2.isEmpty()) {
|
||||
queue1.add(queue2.poll());
|
||||
}
|
||||
return poll;
|
||||
}
|
||||
|
||||
int pop(){
|
||||
if (queue1.isEmpty()) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
while (queue1.size()>1){
|
||||
queue2.add(queue1.poll());
|
||||
}
|
||||
Integer poll = queue1.poll();
|
||||
while (!queue2.isEmpty()) {
|
||||
queue1.add(queue2.poll());
|
||||
}
|
||||
return poll;
|
||||
}
|
||||
|
||||
int size(){
|
||||
return queue1.size();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyStack {
|
||||
Queue<Integer> queue1 = null;
|
||||
Queue<Integer> queue2 = null;
|
||||
public MyStack() {
|
||||
queue1 = new ArrayDeque<>();
|
||||
queue2 = new ArrayDeque<>();
|
||||
}
|
||||
|
||||
public void push(int x) {
|
||||
queue1.add(x);
|
||||
|
||||
}
|
||||
|
||||
public int pop() {
|
||||
if (queue1.isEmpty()) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
while (queue1.size()>1){
|
||||
queue2.add(queue1.poll());
|
||||
}
|
||||
Integer poll = queue1.poll();
|
||||
while (!queue2.isEmpty()) {
|
||||
queue1.add(queue2.poll());
|
||||
}
|
||||
return poll;
|
||||
}
|
||||
|
||||
public int top() {
|
||||
if (queue1.isEmpty()) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
while (queue1.size()>1){
|
||||
queue2.add(queue1.poll());
|
||||
}
|
||||
Integer poll = queue1.poll();
|
||||
queue2.add(poll);
|
||||
while (!queue2.isEmpty()) {
|
||||
queue1.add(queue2.poll());
|
||||
}
|
||||
return poll;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return queue1.isEmpty();
|
||||
}
|
||||
}
|
16
src/main/java/cn/whaifree/leetCode/LinkedList/LCR155.java
Normal file
16
src/main/java/cn/whaifree/leetCode/LinkedList/LCR155.java
Normal file
@ -0,0 +1,16 @@
|
||||
package cn.whaifree.leetCode.LinkedList;
|
||||
|
||||
import cn.whaifree.leetCode.model.TreeNode;
|
||||
|
||||
public class LCR155 {
|
||||
|
||||
// https://leetcode.cn/problems/er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof/description/
|
||||
|
||||
class Solution {
|
||||
|
||||
|
||||
public TreeNode treeToDoublyList(TreeNode root) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -9,13 +9,26 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public class listSeries {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
while (true) {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFor() throws InterruptedException {
|
||||
while (true) {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws IOException, ClassNotFoundException {
|
||||
|
||||
ReentrantLock reentrantLock = new ReentrantLock();
|
||||
|
||||
}
|
||||
public static void main(String[] args) throws IOException, ClassNotFoundException {
|
||||
public static void ma1in(String[] args) throws IOException, ClassNotFoundException {
|
||||
List<User> o = new ArrayList<>();
|
||||
o.add(new User(1, "110"));
|
||||
|
||||
@ -50,6 +63,8 @@ public class listSeries {
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class AffinityThreadPoolTest {
|
||||
l = System.currentTimeMillis();
|
||||
synchronized (o) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int finalI = i;
|
||||
int finalI = i; // 在其他线程拿到 i 时,i 可能已经变了
|
||||
executor.submit("A", () -> {
|
||||
System.out.println(Thread.currentThread().getName() + " A " + finalI);
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user