goRGon
BAN USER- 0of 0 votes
AnswersYou have a log file with start/end times of different functions.
- goRGon in United States for Bing
Find the total exclusive working time for a particular method foo().
E.g. Log:
(foo()_start, 10:01);
(foo2()_start, 10:03);
(foo()_start, 10:05);
(foo()_end, 10:08);
(foo2()_end, 10:12);
(foo()_end, 10:20);
Total time: (10:03-10:01) + (10:08-10:05) + (10:20-10:12) = 2 + 3 + 8 = 13
P.S. Recursion calls and inner calls of foo() are possible| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer
If you count like this, then AAA == 0
So I think you should use add +1 to (A-A) and e t.c.
Also you should add +1 to 26^2 because column index starts from 1 == A till 26 == Z so AA == 26^1 +1.
So the result will be smth like this:
BAD;
(26^2 + 1) * (B - A + 1) + (26^1 + 1) * (A - A + 1) + (26^0 + 1) * (D - A + 1)
Correct me if I am wrong
BTW, ifenjoy9 already gave a wonderful solution here:
- goRGon December 03, 2012careercup.com/question?id=14990939