Revolut | Sr SWE | Dubai | Aug 2024 | Reject
Anonymous User
2709
Nov 23, 2024

Revolut | Sr SWE | Dubai | Aug 2024 | Reject

Role: Senior Software Engineer
Outcome: Rejected
comp offered : 350K-450K AED

Observations:

It was evident that they were specifically looking for a Java expert with experience in payment gateway systems, which I believe should have been clearly mentioned in the job description too.

Interview Process:

  1. Initial HR Round:
    Discussed the job description and interview process. The HR team was quite helpful and provided an outline of the question scope for each round.

  2. Coding Round:
    Designed a load balancer for 10 servers and wrote corresponding test cases.

  3. Technical Discussion:

    • Implemented a Java method to process a payment transaction from Account A to Account B.
    • Converted the same logic into an SQL implementation.

For both rounds, the expectation was to write production-ready code, as if it would be deployed immediately—quite a high bar for an interview scenario.

Outcome:

I received a rejection email from HR with detailed feedback, highlighting my inability to write prod level SQL version of the payment transaction problem.

Payment Transaction [for reference, please validate own your own]:

package revolut;

import java.math.BigDecimal;

public class BankAccount {
    private final String accountId;
    private BigDecimal balance;

    public BankAccount(String accountId, BigDecimal initialBalance) {
        this.accountId = accountId;
        this.balance = initialBalance;
    }

    public String getAccountId() {
        return accountId;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public synchronized void deposit(BigDecimal amount) {
        if (amount.compareTo(BigDecimal.ZERO) <= 0) {
            throw new IllegalArgumentException("Deposit amount must be greater than zero");
        }
        balance = balance.add(amount);
        System.out.println("Deposited " + amount + " to " + accountId + ", new balance: " + balance);
    }

    public synchronized void withdraw(BigDecimal amount) {
        if (amount.compareTo(BigDecimal.ZERO) <= 0) {
            throw new IllegalArgumentException("Withdrawal amount must be greater than zero");
        }
        if (balance.compareTo(amount) < 0) {
            throw new IllegalArgumentException("Insufficient funds in account " + accountId);
        }
        balance = balance.subtract(amount);
        System.out.println("Withdrew " + amount + " from " + accountId + ", new balance: " + balance);
    }

    public static void transferMoney(BankAccount fromAccount, BankAccount toAccount, BigDecimal amount) {
        if (amount.compareTo(BigDecimal.ZERO) <= 0) {
            throw new IllegalArgumentException("Transfer amount must be greater than zero");
        }

        BankAccount firstLock = fromAccount;
        BankAccount secondLock = toAccount;

        if (fromAccount.getAccountId().compareTo(toAccount.getAccountId()) > 0) {
            firstLock = toAccount;
            secondLock = fromAccount;
        }

        synchronized (firstLock) {
            synchronized (secondLock) {
                fromAccount.withdraw(amount);
                toAccount.deposit(amount);
                System.out.println("Transferred " + amount + " from " + fromAccount.getAccountId() +
                        " to " + toAccount.getAccountId());
            }
        }
    }

    public static void main(String[] args) {
        BankAccount accountA = new BankAccount("A123", new BigDecimal("5000.00"));
        BankAccount accountB = new BankAccount("B456", new BigDecimal("3000.00"));

        // Create threads to simulate concurrent transfers
        Thread t1 = new Thread(() -> transferMoney(accountA, accountB, new BigDecimal("1000.00")));
        Thread t2 = new Thread(() -> transferMoney(accountB, accountA, new BigDecimal("500.00")));

        t1.start();
        t2.start();

        try {
            t1.join();
            t2.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("Final balance of Account A: " + accountA.getBalance());
        System.out.println("Final balance of Account B: " + accountB.getBalance());
    }
}
Comments (4)