codeTest_and_Interview
Interview Code Test
I am sharing some Code Test during my Interview, and also some practice Code example.
今天分享我一些Live Coding 面試問題,還有一些刷題的問題。
Amazon Live Code
Q1. read file into datastucture and search like logfile
If we have a log.txt, as below, you need to and search specfic string, like cat.
- log.txt
1
2
31 cat
2 lion
3 apple
Answer 1: list
1 | with open("log.txt", "r") as textfile: |
Answer2: using dictionary
1 | d={} |