Facebook | USA SF
Anonymous User
1236

Phone Screen
Two Questions

  • Subarry Sum equal to K, extension, what if divide sub array into two equal parts
    Input: [5,5,1,11], k = 2 Output = [[5,5,1], [11]]
    Input: [3,2,1,6, 2,4], k = 3, Output = [[ 3,2,1], [6], [2,4]]
    Input: [5,5,1], k = 3, Result = []
  • Swap K digits to make it small.
    Input: [1,2,3,4,5], k = 1 --> Output [1,2,3,4,5]
    Input: [5,1,2,3,4], k = 1 --> Output [1,5,2,3,4]
    Input: [5,1,2,3,4], k = 2 --> Output [1,2,5,3,4]

Onsite
Coding Round 1

  • Nested Integer Path Sum at each level
  • Balance brackets. Only '(',')' are allowed with any random characters
    Input: (a) Output -> (a)
    Input: ((a(( Output -> a
    Input: (A)()) Output -> (A)()

Coding Round 2

  • [t,t,t, w,w,w,] maximise number of t, by replacing k 'w'.
    Input: [t,t,t,w,w,w]., k = 2 Output = 5
    Input: [t,t,t,w,t,w] k = 1 Output 3
  • Remove consecutive characters from a string
    Input: "aaabbb" Output: ""
    Input: "abbbab" Output "b"
    Input: "abc" Output "abc"

Design

  • Typical design question, design Facebook Feed

Behavioral

  • All scenario based questions
Comments (8)