Time: 2015-10-11 14:10 ~ 18:20
Venue: No. 8th, Chandon Digital Valley area B, No. 1th, Northeast Wang Xi Road, Haidian District, Beijing
One, 1 sides
1. Ask Project experience
2. Find the largest subarray of integers in an integer array and
intGet_max_sum (Constvector<int> &nums) { intAns =0; if(nums.size () = =0) return 0; intCnt_val = nums[0]; if(nums.size () = =1) {ans= ans > cnt_val?Ans:cnt_val; returnans; } for(inti =1; I < nums.size (); i++) { if(Cnt_val >0) Cnt_val+=Nums[i]; ElseCnt_val=Nums[i]; Ans= ans > cnt_val?Ans:cnt_val; } returnans;}intMain () {structTestCase {vector<int>Nums; intret; } test_cases []= { { { -1, -1, -1 }, 0 }, { { -1, -9,Ten, -3, + }, - }, { { -1, -, -9,Ten, -3, + }, Panax Notoginseng }, }; for(intIII =0; III <sizeof(test_cases)/sizeof(TestCase); iii++) {TestCase&TC =TEST_CASES[III]; Auto ret=get_max_sum (tc.nums); if(Tc.ret! =ret) {cout<<"Case #"<< III <<"failed"<<Endl; cout<<"Actual ret="<< ret <<Endl; return-1; } } return 0;}
Two, 2 sides
1. Thread Safety
1.1 vector, is the list thread-safe?
1.2 For linked lists, how can you make them thread-safe? A more efficient solution?
2015-10-11 [Drip]--research Engineer--1~4 Noodle