Bloomberg LP Interview Question for Software Engineer Interns

Country: United States
Interview Type: Phone Interview

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

def find_min_diff(arr):
    arr = sorted(arr)
    min_diff = None
    for i in range(1, len(arr)):
        diff = arr[i]-arr[i-1]
        if min_diff is None or min_diff>diff:
            min_diff = diff
    return min_diff

if __name__=='__main__':
    data = [
            [[100, 20, 52, 18, -4], 2]

    print('Find minimum difference between items in array')
    for d in data:
        print('array is', d[0], 'result', find_min_diff(d[0]), 'expected', d[1])

- Loghman Barari October 24, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

- Kochi October 30, 2019 | Flag Reply

Add a Comment

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


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


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