<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KVGHS6G" height="0" width="0" style="display:none;visibility:hidden"></iframe>

UBS计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(4)
OOD(1)
Algorithm(2)
System Design(1)
高频题(0)
Math(0)
全部(4)
OOD(1)
Algorithm(2)
System Design(1)
高频题(0)
Math(0)
1.Project Build Tool
2.Java: Collections
3.Search Suggestion System
4.Rate Limiting Algorithm
1. Project Build Tool
There is a requirement to upgrade an existing project with Maven support using an external dependency. The project specifications are as follows: The Java version needs to be 1.8, and there is a dependency 'abc-de-version' 1.0.0, where 'abcde' is the name of the external dependency. The dependency package information is 'abcde'. Which of the following are the valid Maven entries for the build file according to the given data?
2. Java: Collections
Which of the following statements is true about ArrayList and Vector in Java? Pick ONE option: A) Vector can be resized while ArrayList cannot be. B) ArrayList is thread-safe while Vector is not. C) Vector is thread-safe while ArrayList is not. D) ArrayList and Vector can both be resized, but Vector is not thread-safe.
3. Search Suggestion System
Design a search suggestion system for an array of n strings 'products' and a word to search 'search'. The system should suggest at most three product names from the products array as each character of the searched word is typed. The suggested products should share a common prefix with the searched word. If more than three products exist with a common prefix, suggest the top three lexicographically sorted products for each character of the search word.
4. Rate Limiting Algorithm
Given a list of incoming request IPs and a list of blacklisted IP patterns, write an algorithm that determines if each request should be blocked or allowed. The rules are as follows: a request is blocked if it matches any of the blacklisted regex IPs, or if the IP address has sent at least 2 requests in the last 5 seconds that have not been blocked. You need to return an array of integers where 1 indicates a request is blocked and 0 otherwise. Consider the constraints and provide a sample input for custom testing, explaining the expected output.