blog

質問02.06.

ここでパリティを判断する必要はなく、1->2->1なら===> 1->2<-1 1->3->3->1==>1->3 3<-1 パブリッ...

Jul 19, 2020 · 1 min. read
ここでパリティを判断する必要はない。1->2->1 ==> 1->2<-1
1->3->3->1==>1->3 3<-1
public class Num0206回文 {
 public boolean isPalindrome(ListNode head) {
 if (head == null || head.next == null) return true;
 ListNode fast = head, slow = head;
 while (fast != null && fast.next != null) {
 fast = fast.next.next;
 slow = slow.next;
 }
 ListNode pre = null;
 while (slow != null) {
 ListNode next = slow.next;
 slow.next = pre;
 pre = slow;
 slow = next;
 }
 ListNode cur = head;
 while (pre != null) {
 if (pre.val != cur.val) return false;
 pre = pre.next;
 cur = cur.next;
 }
 return true;
 }
}
Read next

問題01.08. ゼロマトリックス

クラス Solution { パブリック void setZeroes { int m = , n = matrix[0].leng

Jul 18, 2020 · 1 min read

Js実行コンテキスト

Jul 14, 2020 · 2 min read

HTTP共通ヘッダ

Jul 14, 2020 · 4 min read