摘要: 剑指 Offer 06. 从尾到头打印链表 class Solution { public int[] reversePrint(ListNode head) { Stack<Integer> stack = new Stack<>(); while(head != null){ stack.pus 阅读全文
posted @ 2019-11-20 12:08 无名客nameless 阅读(56) 评论(0) 推荐(0)
摘要: 剑指 Offer 05. 替换空格 class Solution { public String replaceSpace(String s) { StringBuilder str = new StringBuilder(s); int p1 = str.length() - 1; for(int 阅读全文
posted @ 2019-11-20 11:18 无名客nameless 阅读(52) 评论(0) 推荐(0)
摘要: 剑指 Offer 03. 数组中重复的数字 哈希表/set class Solution { public int findRepeatNumber(int[] nums) { HashSet<Integer> set = new HashSet<>(); for(int num : nums){ 阅读全文
posted @ 2019-11-20 10:59 无名客nameless 阅读(56) 评论(0) 推荐(0)
摘要: lc88 class Solution { public void merge(int[] nums1, int m, int[] nums2, int n) { int i = m - 1, j = n - 1; int p = m + n - 1; while(i >= 0 && j >= 0) 阅读全文
posted @ 2019-11-20 10:02 无名客nameless 阅读(63) 评论(0) 推荐(0)