FastPrepFind Pair Closest to K (for E5 :)
Problems/Find Pair Closest to K (for E5 :)

Find Pair Closest to K (for E5 :)

Meta logoMeta● EasyFULLTIMEPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Find and return a pair of integers in a sorted array (all integers are positive) that, when summed up, bring you the closest to the value of k.

Example Input: [5, 8, 14, 17, 25, 40, 43] k: 35 Expected Output: (8, 25) since 8 + 25 = 33 which is closest to 35 (sum could be equals to, smaller or larger than k)

Complete the function findPairClosestToK in the editor.

findPairClosestToK has the following parameters:

  1. 1. int[] arr: a sorted array of integers
  2. 2. int k: the target sum

int[]: an array of two integers that are closest to the target sum k

The other question was ~~

Function

findPairClosestToK(arr: int[], k: int) → int[]

Examples

Example 1

arr = [5, 8, 14, 17, 25, 40, 43]k = 35return = [8, 25]

The pair of integers (8, 25) when summed up, give us 33 which is the closest to the value of k which is 35. The sum could be equal to, smaller or larger than k, but in this case, 33 is the closest sum to k that can be obtained from the given array.

More Meta Phone Screen questions

  • Convert a Sorted Linked List to a Balanced BSTPHONE SCREEN · Seen Nov 2026
  • Fuzzy Word Lookup With One Misspelled LetterPHONE SCREEN · Seen Nov 2026
  • Multi-Head Attention Forward PassPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Run-Length Encoded Vector Dot ProductPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Mutual-Friend RecommendationsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Time to Buy and Sell StockPHONE SCREEN · Seen Nov 2026
  • First Element Greater Than KPHONE SCREEN · Seen Nov 2026
  • Count Events in Rolling Minute WindowsPHONE SCREEN · Seen Oct 2026
  • Valid Word AbbreviationPHONE SCREEN · Seen Oct 2026
  • Shortest Path in a Binary MatrixPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Compact Conversation History by Token BudgetSierra · PHONE SCREENSierra interview questions
  • Remove Duplicates from Sorted ArrayNykaa · PHONE SCREENNykaa interview questions
  • Minimum Index Distance Between Person and CakeSnowflake · OA · PHONE SCREENSnowflake interview questions
  • Squares of a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
  • Closest Vehicle and Charger in a LineSpotify · PHONE SCREEN
  • Assign CookiesAmazon · PHONE SCREEN
  • Correct an In-Place Array ReversalDuolingo · PHONE SCREENDuolingo interview questions
  • Remove Duplicates From Sorted Array In PlaceKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Merge Two Sorted ArraysCapgemini · PHONE SCREENCapgemini interview questions
  • Remove Duplicates From Sorted Array In PlaceGet My Parking · PHONE SCREEN

Meta interview experiences

  • Meta PhD SWE Intern AI Coding Phone Screen: 1 Experience
  • Meta Business Support Engineer Phone Screen: 1 Experience
  • Meta Software Engineer Onsite Questions: 3 Experiences
  • Meta AI Native Engineer OA and Onsite: 1 Experience
  • Meta AI-Native Coding Interview: 3 Experiences
  • Meta Production Engineer Intern Questions: 6 Experiences
All Meta interview questionsSee Meta hiring insights
Saved
class Solution {
    public int[] findPairClosestToK(int[] arr, int k) {
      // write your code here
    }

}
Checking account…