上一页 1 2 3 4 5 6 7 8 ··· 33 下一页
import com.google.common.base.Charsets; import com.google.common.base.Joiner; import com.google.common.base.Predicate; import com.google.common.base.S Read More
posted @ 2020-09-05 13:27 soft.push("zzq") Views(270) Comments(0) Diggs(0) Edit
public ListNode getKthFromEnd(ListNode head, int k) { ListNode slow=head; ListNode fast=head; int t = 0; for(;fast!=null;){ if(t>=k) { slow=slow.next; Read More
posted @ 2020-09-01 15:11 soft.push("zzq") Views(106) Comments(0) Diggs(0) Edit
private boolean slowAndFastSolution(ListNode head) { if (head == null) { return false; } ListNode slow = head; ListNode fast = head.next; while (fast Read More
posted @ 2020-08-30 12:57 soft.push("zzq") Views(83) Comments(0) Diggs(0) Edit
public int add(int a, int b) { while (a != 0) { int temp = a ^ b; a = (a & b) << 1; b = temp; } return b; } Read More
posted @ 2020-08-30 12:49 soft.push("zzq") Views(115) Comments(0) Diggs(0) Edit
public int divide(int dividend, int divisor) { boolean sign = (dividend > 0) ^ (divisor > 0); int result = 0; if(dividend>0) { dividend = -dividend; } Read More
posted @ 2020-08-30 12:46 soft.push("zzq") Views(201) Comments(0) Diggs(0) Edit
public int divide(int dividend, int divisor) { //判断符号 int symbol=(dividend>0&&divisor>0)||(dividend<0&&divisor<0)?1:-1; //边界情况直接返回 if(dividend==Intege Read More
posted @ 2020-08-30 12:44 soft.push("zzq") Views(166) Comments(0) Diggs(0) Edit
public ListNode removeNthFromEnd(ListNode head, int n) { ListNode dummy = new ListNode(0); dummy.next = head; ListNode first = dummy; ListNode second Read More
posted @ 2020-08-30 10:07 soft.push("zzq") Views(83) Comments(0) Diggs(0) Edit
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1 == null) { return l2; } if(l2 == null) { return l1; } if(l1.val < l2.val) { l1.next = Read More
posted @ 2020-08-29 22:36 soft.push("zzq") Views(132) Comments(0) Diggs(0) Edit
class Solution { public int findRepeatNumber(int[] nums) { int temp; for(int i=0;i<nums.length;i++){ for (;nums[i]!=i;){ if(nums[i]==nums[nums[i]]){ r Read More
posted @ 2020-08-29 21:37 soft.push("zzq") Views(94) Comments(0) Diggs(0) Edit
public int reversePairs(int[] nums) { int cnt = 0; int len = nums.length; for (int i = 0; i < len - 1; i++) { for (int j = i + 1; j < len; j++) { if ( Read More
posted @ 2020-08-29 21:33 soft.push("zzq") Views(162) Comments(0) Diggs(0) Edit
上一页 1 2 3 4 5 6 7 8 ··· 33 下一页