Bloomberg LP Interview Question for Senior Software Development Engineers


Country: India
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
0
of 0 vote

Ordered map in c++ will work. map 1 for <name, number > map2 is for <number, list of names>

- Ravi December 18, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You can use a data structure called Trie, or you can use stl map [ c++ ]

- Nafiul Adnan December 18, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.*;
import java.util.Hashtable;


class Phonebook
{
    static Hashtable h=new Hashtable();
    public static void main(String[] args) 
    {
        String name="Riju";
        search(name);

        search(name);
       
    }

    public static void search(String name)
    {String phn="";
        Scanner sc=new Scanner(System.in);
       if(h.get(name)==null)
       {
            System.out.println("The no for the name: "+name +" is not available");
            System.out.print("Plz enter the phn no: ");
            phn=sc.next();
            add_no(name, phn);
            
       }
       else{
           System.out.println("Number Found under name "+name+" is: "+h.get(name));
       }
    }
    public static void add_no(String name,String phn)
    {
        h.put(name,phn);
        System.out.println("New no is added");
    }
    public static void del_no(String name)
    {
        h.remove(name);
    }
}

- Riju December 29, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For sorted phone book: use sorted hashMap . And searching would take O(1).
For searching based on number, Use trie and add a list of names at the end of number in the trie.

- Jaishree May 21, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For sorted phone book and searching: Use Hash map in C++, insertion and reading data would take O(log n)
For searching based on number, use trie. Searching is O(10) i.e. O(1).

- jayj May 21, 2019 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More