Twitter | Coding Round | Closest Numbers

Result
Ongoing
Posted
28 Sept 2021
263 reads

Summary

I successfully navigated a coding round at Twitter, where I was presented with the "Closest Numbers" problem and provided a Python solution.

How it went

During my coding round at Twitter, I was tasked with solving the "Closest Numbers" problem. I was able to devise an efficient approach and implemented a solution in Python, which I believe addressed the problem requirements effectively.

Questions asked (1)

  1. 01

    Closest Numbers

    Data Structures & Algorithms · Medium

    Given an unsorted array of distinct integers, find all pairs of elements that have the minimum absolute difference between them. If there are multiple pairs with the same minimum difference, return all of them. For example, if the input array is [-20, -3916237, -357920, -3620601, 7374819, -7330761, 30, 6246457, -6461594, 266854], the output should be the pairs that have the smallest difference.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Twitter recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!