This weekend passed
Joker 2018 , it was interesting! But not only by speeches was the conference rich. All sponsoring companies tried to stand out against the “competitors” and we are no exception.
There was a lot of interesting things on the Sberbank-Technologies stand, but I want to tell you about how we stood out.
Our Apache Ignite development
team at SberTech prepared tasks and conducted a rally for those who dared to solve them.
Under the cat you expect the problem, the analysis of solutions and the ability to justify your own solution in the comments.
')
Woe-committers
Petya and Kolya commit in
Apache Ignite one feature per day.
Masha promptly tests every feature and rolls back commits containing errors.
Every third initial commit from Petit and the fifth from Kolya contain an error.
Petya spends an additional 2 days on correcting the error, Kolya 3, and they again do
commit
How many features will be committed in 86 working days, if Masha likes Peter,
and she notices his mistake only on the day when only he is mistaken?DecisionStarting from the 13th day, a cyclical pattern is formed which allows Pete to fix only his every second error.

Villaribo and Villabaggio
Processing an unreliable bank in a group of accounts locks keys
accounts in the order of their announcement in the operation, i.e. from left to right.
Each deadlock is solved manually by bank specialists and takes 10 times more.
time than usual operation.
Processing a reliable bank always blocks keys in ascending order, but spends 2
times longer than a normal operation in an unreliable bank.
In both banks there are 10 accounts, the keys of the accounts are numbers from 1 to 10.
The processing of each bank requires 12 operations.
Operations are carried out in parallel, two at a time. Each operation affects up to 3
accounts:
- operation №1 (accounts: A, B, C), where A = i, B = A + 1, C = (A + B)% 10,
- operation №2 (accounts: D, E, F), where D = 11-i, E = D-1, F = (D + E)% 10,
i varies from 1 to 6.
The execution of the next pair of operations begins only after full completion.
previous.
Keys are locked according to bank policy, one in each of the operations, starting
from operation №1.
If the key is already locked in one of the operations, but is required to perform another,
first the first operation is completed, then the second one continues.
Forced execution of a pair of operations in sequential mode, as expected, occurs 2 times slower than in parallel.
What bank and how many times faster will complete operations?hintTotal:
- 6 iterations,
- 12 operations
- in all operations, except one, 3 keys each.

DecisionIf all keys are different, parallel execution is possible.
If not, then no, and deadlock is possible.

CalculationsUnreliable bank spends on operation 1 "tact", 2 in the case of "difficulties" and as many as 10 in the case of deadlock.
A reliable bank spends on operation 2 "tact" and 4 in the case of "difficulties". Dedlokov reliable does not happen.

AnswerComplete at the same time.
Risks of public repositories
Serezha is a very experienced programmer, extremely reckless and infinitely greedy.
Once he found the source code of his favorite tote on a githaba.
What is the minimum bet that Serezha can win?A simplified tote listing is attached:
class Bid {
Tip # 1- 131072?
- No, get out of the trap :)
Tip number 2What is the minimum bet that Serezha can win?
Tip number 3 th1{ bid.restricted = true; bid.checked = true; } ... th2{ while (!bid.checked) { sleep(1); } assert bid.restricted;
There are no intuitively anticipated visibility guarantees.
You can add them as follows:
volatile boolean checked;
Tip # 4What is the minimum bet that Serezha can win?
Answer java.lang.Integer#MIN_VALUE
However, "0" and even "1" were regarded as the right decision.
Winners
Best tasks solved
-
Yevgeny Zubenko-
Alexander Novikov-
Andrey GolikovThe guys got branded backpacks, t-shirts and, of course, books.