- Given a binary tree, how to get the sum of vertical lines.
tip: try to find a solution with linear time computation. Use a HashMap to store the sums.
- Given a multi-million nodes linked List, how to get the value of the Nth node counting from the tail.
tip: use 2 pointers and save an iteration
- Implement a HashMap with TTL.
tip: override HashMap
- Given a n X n matrix: find the count of the number chains, for example, the following matrix have 2 number chains. Also find the length of the longest chain, for example, the following matrix have max length 7.
1 2 3 0 0 0
0 0 4 5 0 0
0 0 0 6 0 0
0 1 0 7 0 0
0 2 0 0 0 0
0 3 4 0 0 0
tip: Map union and DFS
tip: Map union and DFS
- Given a nXn matrix, find the count of connected areas, for example the following matrix have 2 connected areas.
1 2 3 0 0 0
0 2 4 5 0 0
0 5 0 6 0 0
0 0 0 7 0 0
0 2 0 0 0 0
9 3 4 0 0 0
tip: Map union
tip: Map union
- write a java class that handles bank account deposit, withdraw and sum.
tip: consider 3 tier web application, this code could run in multiple app VMs.
- write a function that returns if two words have the same characters. For example: func("file", "lief") should return true.
tip: HashMap
- A file looks like the following, the first column is the name, the second column is the versions. Read the file in and order the records by the versions.
aafdfad 12.34.1
dfadfadfadf 13.7.90
adfadfadfad 1.2.5.8
dfadfadf 9.0.33
tip: consider library quality code, edge conditions and unit tests.
tip: consider library quality code, edge conditions and unit tests.
- A new IOT thermometer is invented and selling to general public, it is low power, low memory device. Design a system that updates its firmware.
tip: consider board type, micro OS, httpClient, geographically distributed update, selective update, failed update recover, cloud storage, log report, error report, batched roll out, pilot deploy, black out handle, oob handle, traffic zip etc.
- Design a web application that takes start date, end date and city, returns the prices for hotels.
tip: consider thread pool, rest services, factory design pattern, future with timeout, third party content cache, scheduledThreadPool, periodic update, load balancer, database row lock, input/output validation etc.
- Try to give an implementation of cloud storage system.
tip: hypervisor, unix file system or NoSQL, blob, item Id, global read-only but regional write, data center ETL, eventually consistent, object serialization and deserialization.
- Design a program to output the percentage of english, Thai, French etc. words in an article.
tip: character frequency statistics
- A program read millions of time ordered records through a third party api. Due to number round issue, the last few records returned from the third party api are not stable. How to work around this inacuracy in the program.
tip: understand how the round issue happen and took more records so that the round issue caused inaccruacy will fall within the range.
- Design a program that downloads and parses logs to generate events.
tip: through what api the logs are downloaded, why choose rest/soap/http/raw socket, AAA, how to parse, generate event, blocking queue, database update, integrate, program monitoring, log, deployment, what actions will be triggered by certain events, how event flow at back end, inter process communication, etc.
No comments:
Post a Comment