Pergunta de entrevista da empresa Revolut

You will be provided code for Account class (Empty) and class with transferMoney operation that you would need to write. The signature of transferMoney is (Account a, Account b, ???? amount) Then so many questions about SQL transactions and Isolation levels and consistency and they will ask you to write SQL in the comments and implement locking using it (both optimistic and pessimistic) Then so many theory questions about Production environment, Stability patterns ( at least 3), Roll back, deployment strategies. SOLID, Monitoring code and others.

Resposta da entrevista

Sigiloso

21 de out. de 2024

I implemented withdraw and deposit and introduced ReentrantLock for thread safety. I avoided deadlock by maintaining the order of locking in transferMoney code. I used double at first ad the amount type but you should use BigDecimal and you need to initialize it with String like (new BigDecimal("0.1") or else it will fail.