注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
一共两题 hackerrank平台1. 俩linked lists, 以及俩int a and b, merge the two lists by removing the ath through bth nodes in list 1 and inserting list2 in their place. 即:
list1_init=list1_1->...->list1_a->...->list1_b->...->list1_n
list2=list2_1->...->list2_2->...->list2_m
list1_merged=list1_1->...->list1_{a-1}->list2_1->...->list2_m->list1_{b+1}->...->list1_n
2.metro land festival.1point3acres
metro land is a country located on a 2D plane. They are having a summer festival for everyone in the country and would like to minimize the overall cost of travel for their citizens. Costs of travel are calculated as follows:
`A city is located at coordinates (x,y)
`The festival is located at coordinates (a,b). 1point 3 acres
`Cost of travel from a city to the festival = |x-a|+|y-b| per person. 1point 3acres
The festival can be held at any location in Metro Land. Find the optimal location for the festival, defined as the location with the minimal total travel cost assuming all people attend. Determine the total cost of travel for all citizens to go to the festival at that location.
. From 1point 3acres bbs
祝大家笔试面试顺利啦~再求个米 谢谢~
|