avatar
贡献一道面试题# JobHunting - 待字闺中
m*k
1
Please read all the instructions before you start writing the code for this
programming exercise. You have 1-hour to submit your solution (so please
keep track of your time).
(Exercise)
Write a program to read a file and
a) print the number of occurrences of each word
b) print the largest word that starts and ends with the same character.
(Notes)
Anything that is separated by space - “ “ should be treated as a word.
Fullstops - “.” do not count as a part of the word and don’t qualify as a
word to be counted as separately.
(How to approach the problem)
Do not worry about the code syntax, we know this is a free text editor
Do not copy paste from any place outside of this test browser window, we
want to see how you approach the problem
If something is unclear, write your assumption as a part of the code
comments so that it doesn't stop you from finishing this assignment.
Using the right approach is more important than finishing the code (Write
clean, well designed, testable, efficient code)
Use any programming language you like (we prefer if you use java)
(Eg)
Data.txt:
McMurdo Station is a U.S. Antarctic research center on the south tip of Ross
Island, which is in the New Zealand claimed Ross Dependency on the shore of
McMurdo Sound in Antarctica. It is operated by the United States through
the United States Antarctic Program, a branch of the National Science
Foundation. The station is the largest community in Antarctica, capable of
supporting up to 1,258 residents,[1] and serves as the United States
Antarctic science facility. All personnel and cargo going to or coming from
Amundsen–Scott South Pole Station first pass through McMurdo.
Result:
Word -> Count
---------------
McMurdo -> 2
station -> 3
is -> 5
….
….
Longest word that ends and starts with the same character:
------------------------------------------------------------
Antarctica
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。