📜 ⬆️ ⬇️

IT training - current brain teaser'y leading companies

Many have heard about the tricky questions and tasks that are given at interviews at Google, Microsoft, Apple, Intel, IBM, Amazon, SpaceX, Yahoo, Facebook, etc., as well as Russian Yandex and Mail.ru. They are aimed at assessing technical skills or testing university knowledge, logic, and thinking.

Before submitting a resume, it is better to thoroughly prepare by solving at least a few such problems. The real job can be found online. They lay out both the developers and the companies themselves.

In this article we open a rubric in which we will publish several fresh tasks or questions. Answers and solutions will appear within a week after publication. You can also offer your solution in the comments.
')
This week we are posting 5 interesting tasks that were recently proposed to be solved by Google developers.

1. Create a random 4-digit even number. Two adjacent numbers must be different.

public int getNumber(){ } 

2. For the entered word, find the following in the lexicographical order from those presented in the array.

Example:

Word List:
[Cat, dog, cow, donkey, zebra, monkey],
input
duck
output
monkey

Input
dog
output
donkey

Can you use wood to solve?

 public String findNextWord(List<String> words, String input){ } 

3. Given an array of integers, print all the numbers that satisfy the following requirement:

when the number is greater than each number to the left and less than each number to the right.

4. For a string chemical formula of the type “C6H2 (NO2) 3CH3”, output the card with the key as an element and the value as its number. The element can have two characters, for example Fe2 (SO4) 3

 public HashMap<Character, Integer> getCount(String chemicals){ } 

5. At school, the student receives a reward if he has no more than 1 pass and 3 late arrivals. Given the record of student attendance, represented by a line with three possible characters "L" ("Late"), "A" (Absent), "O" ("Came on time").

Check if the student is eligible for a reward. Example:

 @INPUT (String) "OLLAOOOLLO" @RETURN (Boolean) False 

A student cannot claim remuneration, because “LLA” means that he is late 3 times in a row.

 @INPUT (String) "OLLOAOLLO" @RETURN (Boolean) True 

Optional :

If it is known that the length of the attendance line is n, how many ways are there to visit with receiving a reward.

NB

Translation of technical texts was not easy, even with the help of experienced developers. Judging by your comments, we have failed, therefore, below are the sources in English. Some tasks, perhaps, in the original, too, were given incorrectly.

1. Generate a random 4-digit even number: the adjacent 2 digits must be different.
 public int getNumber(){ } 

2. Find the word next word from the list of words.
Example
Words list
[Cat, dog, cow, donkey, zebra, monkey],
input
duck
output
monkey

Input
dog
output
donkey
Can you use trie to solve it?

 public String findNextWord(List<String> words, String input){ } 

3. Given the array of integers, it is necessary to print the code.

4. For a string chemical formula like, “C6H2 (NO2) 3CH3”,

element can have two chars, for example Fe2 (SO4) 3

 public HashMap<Character, Integer> getCount(String chemicals){ } 

5. In school a student gets rewarded for 3 times continuously.
Possible characters 'L' (Late), 'A' (Absent), 'O' (On time),
check whether the student qualifies for the reward.

eg
 @INPUT (String) "OLLAOOOLLO" @RETURN (Boolean) False 

The student doesn’t qualify for reward because "LLA" means he was late for 3 times in a row.

 @INPUT (String) "OLLOAOLLO" @RETURN (Boolean) True 

Follow-up:
There are many ways to get the reward.

Source: https://habr.com/ru/post/328454/


All Articles