Bank of America Interview Questions
- 0of 0 votes
AnswersMagical binary strings are non-empty binary strings if the following two conditions are true:
- maulish October 15, 2017 in United States
1. The number of 0's is equal to the number of 1's.
2. For every prefix of the binary string, the number of 1's should not be less than the number of 0's.
A magical string can contain multiple magical substrings. If two consecutive substrings are magical, then we can swap the substrings as long as the resulting string is still a magical string. Given a magical binary string, str, perform zero or more swap operations on its consecutive magical substrings such that the resulting string is as lexicographically large as possible. Two substrings are considered to be consecutive if the last character of the first substring occurs exactly one index before the first character of the second substring.
Input Format
a single binary string, str.
Constraints
It is guaranteed that str is a binary string of 1's and 0's only.
1 ≤ length(str) ≤ 50
It is guaranteed that str is a magical string.
Output Format
Find a string denoting the lexicographically largest magical string that can be formed from str.
Sample Input 0
11011000
Sample output
11100100
Explanation of sample
Given the magical string str = 11011000, we can choose two consecutive magical substrings, 1100 and 10, to swap such that the resultant string, str' = 11100100, is the lexicographically largest possible magical string possible. Thus, we return the value of str', which is 11100100, as our answer.| Report Duplicate | Flag | PURGE
Bank of America - -1of 1 vote
AnswersCreate a CostDomainObject named as CostDTO (like Data transfer object or value object) with
- Sameer July 10, 2017 in United States
three attributes, costId as type String and costAmout as type BigDecimal, effectiveDate as Date.
Override equals and hashcode methods based on costId.
Create Interface CostCalculator taking above CostDTO object as 2 Arguments
1) CostDTO add(CostDTO arg1, CostDTO arg2);
2) CostDTO subtract(CostDTO arg1, CostDTO arg2);
Implement the above 2 methods. You are creating those methods to sum up or subtract cost
amounts based on costId.
Throw a checked exception when the costIds are not the same.
Mostly what I am looking for is how you test your code. This is important as you will be
re-factoring/rewriting existing code or going to enhance existing functionality. We try to do test
first development| Report Duplicate | Flag | PURGE
Bank of America Java Developer - 0of 0 votes
AnswersWe are given a book with N number of pages and two words. Find the distance(in pages) between the first occurrence of first word and first occurrence of second word. For Example, you are given the book "Thinking in C++" and two words 1. "Inheritance" whose first occurrence is in page 220 and 2. "Polymorphism" whose first occurrence is in page 350, the result would be 130. You can take your decision to choose how the data structure of the book would be.
- iamaniceboy16 November 05, 2016 in United States| Report Duplicate | Flag | PURGE
Bank of America Dev Lead Algorithm - 0of 0 votes
AnswersDerived* d =new Base;
- jkl March 23, 2016 in India
// why this is not possible| Report Duplicate | Flag | PURGE
Bank of America - 1of 1 vote
AnswersSecond Least common element from an Integer array.
- PS February 08, 2016 in United States
Example:
[5,5,4,5,4,6,6,6,1,3,3,4,4,5,4]
Answer: 3
Reason: {1=1, 3=2, 4=5, 5=4, 6=3}| Report Duplicate | Flag | PURGE
Bank of America Software Engineer Algorithm - 0of 0 votes
AnswersGiven the fact that you have a map <SessionId, SessionValueObject> , . The sessionValueObject contains timestamp as well associated with the session. In generality, we are maintaining a key value pair. And each session has a timestamp associated with it.
- jimmy514in April 11, 2013 in United States
Now the question was given a particular timestamp associated with a sessionValueObject, we need to implement a data structure such that,
given a timestamp t1, we need to free/ remove all the sessionValueObjects associated after the timestamp t1.
How do we do this efficiently?| Report Duplicate | Flag | PURGE
Bank of America Java Developer - 2of 2 votes
AnswersI was asked to explain memento pattern.I explained with this example.
class Originator:ICloneable { public string a; public int b; public object Clone() { Originator o = new Originator(); o.a = this.a; o.b = this.b; return o; } } class CareTaker { List<Originator> l = new List<Originator>(); public void SaveMemento(Originator o) { l.Add((Originator)o.Clone()); } public Originator RetrieveMemento(int i) { return l[i]; } } class Program { static void Main(string[] args) { CareTaker c = new CareTaker(); Originator o = new Originator(); c.SaveMemento(o); } }
The interviewer said this is is different from memto pattern ... can anyone explain where the difference is!!!
- Jack March 21, 2013 in India| Report Duplicate | Flag | PURGE
Bank of America Software Engineer / Developer Algorithm - 0of 0 votes
AnswersThere is a boat on the water. There is a rock in it. At this time, assume the level of the water is L1. Now say, you threw the rock into the water and it reached the bottom. Now what will be the level of the water?
- endless October 16, 2012 in United States| Report Duplicate | Flag | PURGE
Bank of America Software Engineer / Developer Brain Teasers - 0of 0 votes
Answerswhere would you see yourself 5 years from now?
- Surabhi May 26, 2011| Report Duplicate | Flag | PURGE
Bank of America Associate Behavioral - 0of 0 votes
AnswersWhy do you want to join BOA?
- Surabhi May 26, 2011| Report Duplicate | Flag | PURGE
Bank of America Associate Behavioral - 0of 0 votes
Answershow would you know if a map is corrupted?
- mita.baxi September 25, 2009| Report Duplicate | Flag | PURGE
Bank of America Software Engineer / Developer C++ - 0of 0 votes
Answers1) Type of stl containers
- mita.baxi September 24, 2009
2) difference in composition, agregation,association.
3) Predicates
4) Deadlock and Starvation
5) Raised condition
6) Diff in Conversion ctr and explicit ctr
7) diff in has_map and map
8) explain hash_map and bucketing
9) virtaul inheritance, diamond problem
10) function adaptors
11) fucntors
12) function objects
13) in how many ways two classes A and B be related to each other.
14) diff between vector and dqueue
15) Repopulation of dqueue and its complexity.
16) types of iterators
17) how would you implement a map.
18) concept of immutability.| Report Duplicate | Flag | PURGE
Bank of America Financial Software Developer C++ - 0of 0 votes
AnswersOn January 1, 2007 two new societies S1 and S2 are formed each with n members. On the first day of each subsequent month, S1 adds b members while S2 multiplies its current number of members by a constant factor r. Both the societies have the same number of members on July 2, 2007. If b=10.5n, what is the value of r?
- renji October 15, 2007| Report Duplicate | Flag | PURGE
Bank of America Software Engineer / Developer Brain Teasers - 0of 0 votes
AnswersAsked a couple of questions about sorting algorithms, time and space complexity.
- Chandan February 11, 2006| Report Duplicate | Flag | PURGE
Bank of America Software Engineer / Developer Terminology & Trivia - 0of 0 votes
AnswersAsked a few questions about my current research.
- Chandan February 11, 2006| Report Duplicate | Flag | PURGE
Bank of America Software Engineer / Developer Experience