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

Square计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(1)
OOD(0)
Algorithm(1)
System Design(0)
高频题(0)
Math(0)
全部(1)
OOD(0)
Algorithm(1)
System Design(0)
高频题(0)
Math(0)
1.Implement a Page Redirection Function
1. Implement a Page Redirection Function
Design a function that handles page redirection. Given the current page URL, such as 'https://a/b/c/d/e.html', and a link for the next page, such as 'abc://c/d/e.html', determine if the link is a full path or a relative path. If it is a full path, return it directly. If it is a relative path, like 'd/e/g', return the full path by appending it to the current URL, resulting in 'https://a/b/c/d/d/e/g'. Discuss the various branches and edge cases that need to be considered, and how you would handle them in your implementation.