- PVSM.RU - https://www.pvsm.ru -
Мы подготовили для Вас новый выпуск с интересными задачами с собеседований в Apple.

В Apple соискателями могут задать вопросы не только технического плана, но и о сокровищах и пиратах (интересно, связано ли это с позицией компании в отношении нелегального контента?). Вопросы и задачи, как всегда, разного уровня сложности. В целом, нужно отметить, что доля логических задач вытесняется чисто техническими вопросами, но тем не менее, головоломки на собеседованиях все ещё встречаются.
Seven pirates attacked the ship and looted some rare gems from them. They decided to rest for some time and then divide the gems later. While everyone was resting, two pirates wake up and planned to divide gems equally between the two. When they divided gems equally, one gem was left. So, they decided to wake up the third pirate and divide among three, but alas again one gem was left. They decide to wake up the fourth pirate to divide the gems and again one gem was left. The same happened again with the fifth and sixth. Finally, they woke up the 7th pirate and this time the gems were divided equally.
How many minimum gems did they stole in total ?
I have two coins.
* One of the coin is a faulty coin having tail on both side of it.
* The other coin is a perfect coin (heads on side and tail on other).I blind fold myself and pick a coin and put the coin on table. The face of coin towards the sky is tail.
What is the probability that other side is also tail?
Я, с завязанными глазами, беру монету и подбрасываю её на стол. Видимая часть монеты — решка.
Какова вероятность, что на обратной стороне — тоже решка?
Given a binary tree, a target node in the binary tree, and an integer value k, print all the nodes that are at distance k from the given target node. No parent pointers are available.
Consider the tree shown in diagram:
20 / 8 22 / 4 12 / 10 14Input: target = pointer to node with data 8; root = pointer to node with data 20; k = 2.
Output: 10 14 22If target is 14 and k is 3, then output should be “12 20”
Рассмотрим дерево:
20
/
8 22
/
4 12
/
10 14
Вход: target = указатель на узел 8; root = указатель на узел 20; k = 2.
Выход: 10 14 22
Если target = 14 и k = 3, тогда выход должен быть “12 20”.
A car factory has two assembly lines, each with n stations. A station is denoted by Si,j where i is either 1 or 2 and indicates the assembly line the station is on, and j indicates the number of the station. The time taken per station is denoted by ai,j. Each station is dedicated to some sort of work like engine fitting, body fitting, painting and so on. So, a car chassis must pass through each of the n stations in order before exiting the factory. The parallel stations of the two assembly lines perform the same task. After it passes through station Si,j, it will continue to station Si,j+1 unless it decides to transfer to the other line. Continuing on the same line incurs no extra cost, but transferring from line i at station j – 1 to station j on the other line takes time ti,j. Each assembly line takes an entry time ei and exit time xi which may be different for the two lines. Give an algorithm for computing the minimum time it will take to build a car chassis.
Given an n x n matrix, where every row and column is sorted in increasing order. Given a key, write a program finding whether this key is in the matrix.
Ответы будут даны в течение следующей недели — успейте решить. Удачи!
Автор: reci
Источник [1]
Сайт-источник PVSM.RU: https://www.pvsm.ru
Путь до страницы источника: https://www.pvsm.ru/programmirovanie/278070
Ссылки в тексте:
[1] Источник: https://habrahabr.ru/post/353488/?utm_campaign=353488
Нажмите здесь для печати.