Financial Software Developer Interview Questions | Glassdoor.co.uk

# Financial Software Developer Interview Questions

73

Financial software developer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Financial Software Developer at Bloomberg L.P. was asked...

4 Nov 2014
 Design an algorithm to find the first unique element in an array.8 AnswersOne possibility that comes in mind: * Walk the array, create a hashmap (key is the value in array, value is the count of such values). * Walk the array again and check the count in the hash map, once you hit 1, you have the first unique value. This is O(n) both space and time.Are you sure that this is O(n), it is definitely O(n^2), you go over all items twice.dear utk O(2n) = O(n) != O(n^2)...Show more responsesIts a hashmap. It never guarantees you the order in which you inserted the elements...!!@ankush: this is where LinkedHashMap comes into play.An easier one would be to sort the array and since they are asking for the first unique element return the first element that does not appear more than once in the newly sorted array.@ankush: That does not matter, you do not need to keep the order in the hash map. You go again through the original array, so you definitely find the first unique value. The hashmap is just for bookkeeping.@kabajiegara: No, that will not work, consider array "2 1" - if you sort, you'll have "1 2" and would thus return 1, which is the wrong answer because the first unique is 2.

### Financial Software Developer at Bloomberg L.P. was asked...

22 Dec 2012
 A rabbit wants to climb some stairs and it can do steps of 1 or 2. How many possible paths are there to follow ( e.g 1-1-1... or 2-2-2 ... or 2-1-2-1... etc)6 Answersuse recursion2^n possibility...F(n) = F(n-1)+F(n-2)Show more responsesSummation(i=0,floor(n/2))[(n-i)C(i)]. I'm sure this can be further simplified though.Correction on the above: Summation(i=0,floor(n/2))[(n-i)P(i)].Summation(i=0,floor(n/2))[(n-i)C(i)] is correct. I need to sleep. Sorry.

### Financial Software Developer at Bloomberg L.P. was asked...

4 Dec 2009
 write a function that returns the first unique element in an array5 AnswersWhat the type of elements in the array? If character, set up the hash table, and scan the array. the hash table stores the index of each element. If the element appears more than once, update the table as a negetive value. After scanning, find the smallest index value from the hash table, which would be the first uniqure element. The time complex gonna be O(n), where n is the length of array.I wrote a sample program here. (I use map container here to replace hash_map. The doesnot work on my computer) #include "stdafx.h" #include #include using namespace std; static int find_unique_ele(char*,int); int _tmain(int argc, _TCHAR* argv[]) { char test = {'a','b','c','b','c','a'}; int min_index = find_unique_ele(test,6); if (min_index store_table_value; map store_table; while(i ::const_iterator test_it = store_table.find(*test); if(test_it != store_table.end()){ store_table[*test] = -1; } else{ store_table.insert(map::value_type(store_table_value(*test,i))); } i++; test++; } map::const_iterator table_it = store_table.begin(); store_table_value temp_value = *table_it; int min_index = temp_value.second; while(++table_it != store_table.end()){ temp_value = *table_it; if(temp_value.second < min_index || min_index < 0){ min_index = temp_value.second; } } return min_index; }I think in the above solution you have to scan the original array twice making it order (2n) or O(n). The 2nd scan is needed to determine the corresponding entry in the hash table whether it is unique or not. We need this to determine the first unique element in the array.Show more responsesSort the list then scan the list looking for a data item that does not match the previous item or the next item.very easy with c++ stl using unique() function or use hashtable for O(1) look -up HashTable mm = new HashTable(myArray.count()); for(int i =0; i

### Financial Software Developer At Bloomberg at Bloomberg L.P. was asked...

2 Aug 2010
 int i=14; if (i=15) i++; How much is i?4 Answers16You get an exception. i=15 isn't equality test, but assignment. if statement throws exception if the result of a test isn't a boolean.bagibyte is wrong no exception is thrown (in c++/c) ... the programmer made an error using '=' instead of '==' there for if (i =15) equates to true and i is set to 15 the i++ then increments it to 16Show more responsesanonymous is right, also wants to mention i=15 returns 15 and is true

### Financial Software Developer at Bloomberg L.P. was asked...

20 Jun 2010
 You have a large data file, consisting of ten-digit numbers separated by new-line characters. Write a program in C to sort it, using at most 20MB of memory. Make it efficient.4 AnswersUsing external sort ?That works, and a quick implementation in C will score you some points, but you can do much better than that. I believe the solution they're looking for is Pigeonhole sort.I think that combination of external sort and radix sort could also work well.Show more responsesSince you can't load whole file into memory and sort in place, you should use a sorting algorithm which sorts data by buckets. Probably interviewer was asking about any **merge sort**. It's most famous nLog(n) algorithm which can split data, sort splits and then merge buckets. Interviewer will be happy if you know f.e. radix sort, but merge sort is quite enough.

### Financial Software Development - Internship at Bloomberg L.P. was asked...

23 Mar 2013
 Most efficient way to find the most frequent number (0-255) in a string of numbers4 AnswersMapI think they were probably looking for a tweaked pidgeonhole sort to count the duplicates.//count in two passes.. int function() { int nums; //assume this array holds all the number between 0 to 255 int counter = {0,};//all init to zero for(int i=0;i counts[i]) max = i; } return max; }Show more responsesPrevious solution is okay. Since your data type is in range [0,255] (1 byte), then storing an array of counters and 2 loops is a good trade off memory/cpu consumption. So your code will run in 2n time( linear, O(n)), and use 256 * sizeof(size_t). Interviewer wasn't interested in algorithm, he was interested how you can make trade offs mem/cpu

### Financial Software Developer at Bloomberg L.P. was asked...

29 Apr 2010
 2 pieces of string of different length and non-uniform width, each take one hour to burn. the remaining length of a burning string doesn't tell you how much longer it burns for. with a lighter measure 45 mins.3 Answerslight one string. light the second string on both ends. when he second string will be completely burnt(that will take 30 min), light the other end of the first string. wait until the first string is burnt... et voila!!!they EACH take one hourTie both strings together and light at both ends. Let them burn for 37.5 mins.

### Financial Software Developer at Bloomberg L.P. was asked...

25 Nov 2011
 There are one hundred closed lockers in a hallway. A man begins by opening all one hundred lockers. Next, he closes every second locker. Then he goes to every third locker and closes it if it is open or opens it if it is closed (e.g., he toggles every third locker). After his one hundredth pass in the hallway, in which he toggles only locker number one hundred, how many lockers are open?2 Answersthere are 10 lockers open. (The question and the answer are copied from the book)Locker I will be toggled(locked/unlocked) X times. Where X is a number of dividers of number I. So count of numbers in range [1, 100] with odd dividers count will be unlocked after 100th step. If you need to implement the algorithm then your main problem will be how to find dividers count for for a number. Since there is less than 24 prime numbers in a range then calculations are pretty simple. ;)

### Financial Software Developer at Bloomberg L.P. was asked...

23 Nov 2009
 template int Product (T1 a, T2 b, T3 c) { return a * b * c; } What is the error in the sample code above?4 AnswersI think that: template Should use , not ; between the types here Tutorial Example: template T GetMin (T a, U b) { return (aActually returning an int could work in some cases. Either the result can be implicitly converted to int or there is a conversion operator defined.Show more responses One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

### Financial Software Developer at Bloomberg L.P. was asked...

3 Feb 2010
 how can I count the bit set to 1 in an integer? What if I want to optimize the process to work with several integers?2 Answershe wanted me to speak a lookup tableint BitCount(unsigned int u) { unsigned int uCount = 0; for(; u; u>>=1) uCount += u & 0x1u; return uCount; } 2nd part Copy the integers to a piece of memory and pass its address in to the function above
110 of 73 Interview Questions