2017年8月26日

linkedlist--lecture-4

摘要: 1、链表数据结构 内存利用率高;动态分配 2、链表类定义 单向链表节点 public calss ListNode { int val =0; ListNode next = null; public void Node(int val_) { this.val = val_; this.next 阅读全文

posted @ 2017-08-26 21:00 Shihu 阅读(394) 评论(0) 推荐(0) 编辑

lecture-7 递归

摘要: 1、例题--排列 Permutation Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2 阅读全文

posted @ 2017-08-26 21:00 Shihu 阅读(195) 评论(0) 推荐(0) 编辑

[LeetCode]169. Majority Element

摘要: 1.Description Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may a 阅读全文

posted @ 2017-08-26 20:59 Shihu 阅读(278) 评论(0) 推荐(0) 编辑

234. Palindrome Linked List

摘要: 旋转链表函数 public ListNode reverse(ListNode head) { ListNode prev = null; while (head != null) { ListNode next = head.next; head.next = prev; prev = head; 阅读全文

posted @ 2017-08-26 20:58 Shihu 阅读(305) 评论(0) 推荐(0) 编辑

导航