Pull to refresh
0
Spice IT Recruitment
ИТ-специализированное кадровое агентство

Выпуск#3: ITренировка — актуальные вопросы и задачи от ведущих компаний

Reading time 2 min
Views 3.9K
Эту неделю завершаем подборкой задач и вопросов, которые часто дают на собеседованиях в Facebook. Задачи выбрали разных уровней сложности от «Easy» до «Hard». Условие снова оставили на английском языке. Варианты решений прикрепим в комментарии через неделю. Good luck!

Вопросы:

1. Вы хотите запустить анимацию через полсекунды после нажатия пользователем кнопки. Какой способ сделать это будет лучшим?

2. Приложение для обмена фотографиями отображает системное уведомление, когда пользователь получает фотографию. Ваше приложение должно отображать фотографию, когда пользователь удаляет уведомление. Какое из следующих действий вам необходимо связать с объектом Notification, который вы передаете в Notification Manager?

Задачи:

1.
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].
Note:
You must do this in-place without making a copy of the array.
Minimize the total number of operations.


2.
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead.

Note:
The sum of the entire nums array is guaranteed to fit within the 32-bit signed integer range.

Example 1:

Given nums = [1, -1, 5, -2, 3], k = 3,
return 4. (because the subarray [1, -1, 5, -2] sums to 3 and is the longest)

Example 2:

Given nums = [-2, -1, 2, 1], k = 1,
return 2. (because the subarray [-1, 2] sums to 1 and is the longest)

Follow Up:
Can you do it in O(n) time?


3.
Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results.

Note: The input string may contain letters other than the parentheses ( and ).

Examples:
"()())()" -> ["()()()", "(())()"]
"(a)())()" -> ["(a)()()", "(a())()"]
")(" -> [""]
Tags:
Hubs:
+3
Comments 10
Comments Comments 10

Articles

Information

Website
www.spiceit.ru
Registered
Founded
2009
Employees
31–50 employees
Location
Россия