Facebook online screening questions

Facebook online screening questions

  1. Given an int array nums and an int target. Find two integers in nums such that the sum is closest to target.
    Similar to: https://leetcode.com/problems/two-sum-less-than-k/
    Example:
    Input: nums = [1, 2, 3, 4, 5], target = 10
    Output: [4, 5]

  2. Given an int array nums of '0' and '1', return the first column index of '1'
    Example:
    0 0 0 0 0 0 1 1 1
    0 0 0 0 1 1 1 1 1
    0 0 0 0 0 0 0 0 1
    0 0 1 1 1 1 1 1 1
    Result: 2 - because in last raw the '1' find with index 2

Comments (3)