Android工程师之ARTS挑战第六期第二周

目标:

  1. 每周至少做一个 leetcode 的算法题
  2. 阅读并点评至少一篇英文技术文章
  3. 学习至少一个技术技巧
  4. 分享一篇有观点和思考的技术文章

第二周

  • LeetCode 23

    /**
     * Definition for singly-linked list.
     * public class ListNode {
     *     int val;
     *     ListNode next;
     *     ListNode(int x) { val = x; }
     * }
     */
    class Solution {
      public ListNode mergeKLists(ListNode[] lists) {
    
            if(lists.length == 0)
                return null;
            if(lists.length == 1)
                return lists[0];
            if(lists.length == 2){
                return mergeTwoLists(lists[0],lists[1]);
            }
    
            int mid = lists.length/2;
            ListNode[] first = new ListNode[mid];
            for(int i = 0; i < mid; i++){
                first[i] = lists[i];
            }
    
            ListNode[] second = new ListNode[lists.length-mid];
            for(int i = mid,j=0; i < lists.length; i++,j++){
                second[j] = lists[i];
            }
    
            return mergeTwoLists(mergeKLists(first),mergeKLists(second));
    
        }
    
    
        private ListNode mergeTwoLists(final ListNode first, final ListNode second) {
            if (first == null) return second;
            if (second == null) return first;
    
    
            ListNode node = null;
    
            if (first.val < second.val) {
                node = first;
    
                if (first.next != null)
                    node.next = mergeTwoLists(first.next, second);
                else
                    node.next = second;
            } else {
                node = second;
    
                if (second.next != null)
                    node.next = mergeTwoLists(first, second.next);
                else
                    node.next = first;
            }
    
            return node;
        }
    }
    
  • 英文技术文章点评z

    最近在做蓝牙的测试工具,所以官方的蓝牙文档看得比较多

    https://developer.android.com/guide/topics/connectivity/bluetooth

    介绍了Android平台有关蓝牙的介绍,蓝牙api的应用,蓝牙如何连接

  • 技术技巧 Java I/O

在这里插入图片描述

IO系统是Java中使用的了装饰者模式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值