Skip to content

Instantly share code, notes, and snippets.

View liuqinh2s's full-sized avatar

刘钦 liuqinh2s

View GitHub Profile
def findFreePort():
"""
函数返回值是当前可用来监听的一个随机端口。
"""
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('localhost', 0))
# 用getsockname来获取我们实际绑定的端口号
addr, port = s.getsockname()
# 释放端口
import java.util.ArrayList;
import java.util.Arrays;
public class Solution {
public void insert(ArrayList<Integer> heap, int val){
heap.add(val);
update(heap, heap.size()-1);
}
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Iterator;
public class Solution {
public static void main(String[] args) {
Solution solution = new Solution();
import java.util.ArrayList;
public class Solution {
public boolean HasSubtree(TreeNode root1,TreeNode root2) {
boolean result = false;
if(root1!=null && root2!=null){
result = doesTree1HaveTree2(root1, root2);
if(!result){
result = HasSubtree(root1.left, root2);
public class Solution {
public ListNode Merge(ListNode list1,ListNode list2) {
if(list1==null){
return list2;
}
if(list2==null){
return list1;
}
ListNode node = new ListNode(0);
public class Solution {
public void partition(int[] array) {
if (array == null || array.length <= 1) {
return;
}
int index1 = 0;
int index2 = 0;
int index3 = 0;
for (int i = 0; i < array.length; i++) {
#include<iostream>
#include<stack>
using namespace std;
struct ListNode{
int value;
ListNode* pNext;
};
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JsonParser {
private String json;
private int index = 0;
private Map<Character, Boolean> numChars = new HashMap<>();
/************************************************
*
* 全局变量
*
* 1. LOG 相关变量和函数
* 2. 延时函数,控制点击速度,寻找最佳的速度,避免被支付宝限制
* 3. 结束函数,自定义结束时候要执行的动作
* 2. 路径和文件相关变量和函数
*
************************************************/
# coding=utf-8
import requests
import time
import os
import json
import queue
import threading
import tushare as ts