Google Interview Question for Software Engineers


Country: United States




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

These are ranges that don't overlap. we can do a binary search, range check, post sorting.

- nooooob June 08, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A Trie [0-9 at each level] can be used this to store this and the bank name can be stored at the terminating node.

- Anon June 10, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A simple sorted array list of pair object holding pair and bank information. sort it by first range number. Do a binary search and print the bank name.

- Mukul June 14, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

can we not simply check if the user input value false in any of these ranges only using if condition?
so when the if condition range is satisfied the bank name is displayed.

- noob June 15, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

TreeMap<Integer, RoutingRange> map = new TreeMap<>();

    String findRoutingNumber(int routingNumber) {
        Map.Entry<Integer, RoutingRange> entry = map.floorEntry(routingNumber);
        RoutingRange range = entry.getValue();
        if (range.end >= routingNumber) {
            return range.bank;
        }
        return null;
    }

    public void addRange(int start, int end, String bank) {
        map.put(start, new RoutingRange(end, bank));
    }

- marutee August 18, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use TreeMap in java

- marutee August 18, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can use binary search to process multiple queries efficiently i.e O(logn). But before that, we ll sort the ranges based on starting element. For a given number, we ll check if that number is greater than the middle range last element or lesser than middle range's first element. We ll recure that way. If it is in the mid range then we simply return the range value.

- Rajat.nitp July 03, 2020 | 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