文档添加关于字符串、字节和void数据类型的说明

在NumPy文档中,常规介绍部分现在包含了关于字符串、字节和void数据类型的信息,以及现有的数值类型。
This commit is contained in:
kyriewhluo 2024-09-12 19:55:16 +08:00
parent b96497213a
commit 63ca326724
5 changed files with 145 additions and 3 deletions

View File

@ -21,7 +21,7 @@
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.18.20</version> <version>1.18.30</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View 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();
}
}

View 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) {
}
}
}

View File

@ -9,13 +9,26 @@ import java.util.concurrent.locks.ReentrantLock;
public class listSeries { 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 @Test
public void test() throws IOException, ClassNotFoundException { public void test() throws IOException, ClassNotFoundException {
ReentrantLock reentrantLock = new ReentrantLock(); 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<>(); List<User> o = new ArrayList<>();
o.add(new User(1, "110")); o.add(new User(1, "110"));
@ -50,6 +63,8 @@ public class listSeries {
", name='" + name + '\'' + ", name='" + name + '\'' +
'}'; '}';
} }
} }
} }

View File

@ -45,7 +45,7 @@ public class AffinityThreadPoolTest {
l = System.currentTimeMillis(); l = System.currentTimeMillis();
synchronized (o) { synchronized (o) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
int finalI = i; int finalI = i; // 在其他线程拿到 i i 可能已经变了
executor.submit("A", () -> { executor.submit("A", () -> {
System.out.println(Thread.currentThread().getName() + " A " + finalI); System.out.println(Thread.currentThread().getName() + " A " + finalI);
return null; return null;