Kujira Sama`s Blog | 什么都略懂一点,生活更多彩一些

  • 首页

  • 标签

  • 分类

  • 归档

ARTS Week 2

发表于 2019-07-17 更新于 2019-07-21 分类于 ARTS 评论数:

Week 2

Algorithm

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None

class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
pre = 0
first = ListNode(0)
curr = first
while(l1 != None) or (l2 != None):
if l1 == None:
x = 0
else:
x = l1.val
l1 = l1.next
if l2 == None:
y = 0
else:
y = l2.val
l2 = l2.next
sum = x + y + pre
mod = sum % 10
pre = sum // 10
curr.next = ListNode(mod)
curr = curr.next
if pre == 1:
curr.next=ListNode(1)
return first.next

Review

imgtool

imgtool工具是包含在《最强Android书:架构大剖析》第三章android启动备份和重置中的工具套件,imgtool能够解析以及提取很多image。这套工具对于研究android的系统镜像提供了很大的帮助。imgtool工具套件提供了Mac OS X和linux的二进制可执行文件和源码。
这套工具可以在你刷机之前,检视这些image,避免被image中恶意软件所害。

Tips

shell 学习第十天—sed 查找与替换

1
2
# 用 shell 命令将 test.log 文件中第 3-5 行的第 2 个“filter”替换成“haha”
sed -i '3,5s/filter/haha/2' test.log

Share

SED 简明教程
sed有着很的处理的文本的能力,它能够通过强大的正则表达式来对文件进行批量的替换,省去了很多的机械作业。

# 算法 # Tips
ARTS是什么
android文件系统中存储的内容
  • 文章目录
  • 站点概览

Mu Yi

什么都略懂一点,生活更多彩一些
7 日志
2 分类
7 标签
RSS
  1. 1. Week 2
  2. 2. Algorithm
  3. 3. Review
  4. 4. Tips
  5. 5. Share
© 2019 Mu Yi
由 Hexo 强力驱动 v3.9.0
|
主题 – NexT.Muse v7.3.0