← Akuna Capital Interview Insights

Akuna Capital·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Interviewed for a software engineering role at Akuna Capital and got a problem about transforming one integer into another with a limited set of operations. Pretty algorithmic, felt like a competitive programming warmup more than a standard interview question.

Questions Asked (1)

Q1

Given two integers A and B, find the minimum number of operations to transform A into B, where the only allowed operations are subtracting 1 from the current value or multiplying the current value by 2. Walk through your approach and time complexity for these cases: A=1,B=2; A=9,B=1; A=2,B=10; A=100,B=500.

Algorithms & Data Structures
Author's notes

My first instinct was to go forward from A, which is a mess because multiplying by 2 can blow up fast and you end up with a huge search space.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Recognize this as a shortest path problem on integers and solve it using BFS from A to B, or equivalently work backwards from B to A using greedy division when even. For the given cases, compute the minimum operations by hand or with the algorithm, and state the time complexity as O(log B) for the greedy approach or O(B) for BFS.

Pro tip: When B > A, working backwards from B to A is more efficient: if B is even, divide by 2; otherwise subtract 1. This greedy strategy is optimal because dividing by 2 reduces the value faster than subtracting 1, and it avoids exploring many states.

1. Clarify the problem and constraints

Confirm that operations are subtract 1 and multiply by 2, and that A and B are positive integers. Note that if A >= B, the only option is repeated subtraction.

2. Choose an algorithm

For small B, BFS from A to B works. For large B, use the reverse greedy approach: from B, if even divide by 2, else subtract 1, until reaching A. This is optimal and runs in O(log B) time.

3. Walk through each case

Compute the minimum operations for the four given pairs using the chosen method, showing the sequence of operations and counting steps.

4. Analyze time and space complexity

State that BFS takes O(B) time and space, while the greedy reverse approach takes O(log B) time and O(1) space. Mention that the greedy is optimal for this problem.

5. Summarize and verify

Double-check each case by forward simulation to ensure the number of operations matches the reverse count, and conclude with the final answers.

Key Points to Mention

  • BFS as a general shortest path approach for state space problems
  • Greedy reverse strategy: divide by 2 when even, subtract 1 when odd
  • Optimality of the greedy approach: dividing by 2 is always better than subtracting 1 when B > A
  • Time complexity: O(log B) for greedy, O(B) for BFS; space complexity: O(1) vs O(B)
  • Edge cases: when A >= B, only subtraction is possible, so answer is A - B
  • Verification by forward simulation for each given case

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.