/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } Read More
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } Read More
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int sum = 0; Read More
1.request对象 客户端的请求信息被封装在request对象中,通过它才能了解到客户的需求,然后做出响应。它是HttpServletRequest类的实例。 2.response对象 response对象包含了响应客户请求的有关信息,但在JSP中很少直接用到它。它是HttpServletRes Read More
public class Thtest { private static final Object obj = new Object(); public static void main(String[] args) { new Thread(new Runnable(){ @Override pu Read More
两个数组先按照数组2的元素顺序将数组1内的元素首先排序,剩下不存在的元素再升序排列 计数排序,先声明没个元素最大值个数长度的数组,利用下标值在数组内存储元素个数。 比照数组2顺序将,从存储个数的数组内拿取并放置在数组1中 再按照个数数组剩余元素按顺序升序输出放置。 class Solution { Read More
基础不太行,重写比较方法 class Solution { public int[][] merge(int[][] intervals) { Arrays.sort(intervals,new Comparator<int []>(){ public int compare(int[] a,int Read More
有一点对数组的用法与Math方法取整用法记录一下吧 class Solution { public int minEatingSpeed(int[] piles, int h) { int left =0; int right = Arrays.stream(piles).max().getAsIn Read More
就记录一下,二分法的用法以及前缀和的用法。 这个题的概率问题,依靠前缀和法把w的每个元素的 概率问题依靠向前求和 然后使用二分法,找出random生成元素的所在位置下标即可。 class Solution { int[] w; public Solution(int[] w) { for(int i Read More