FastPrepMinimum Currency Conversions
Problems/Minimum Currency Conversions

Minimum Currency Conversions

EPAM logoEPAM● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the graph goal and says to use breadth-first search. We chose that conversion edges go both ways, how equal currencies are handled, the limits, and the function signature. Our version is about 95% the same as the reported question.

Each row in pairs contains two currency codes that can be converted directly in either direction.

Return the minimum number of direct conversions needed to move from source to target. Return -1 when no conversion chain exists. If the two codes are equal, return 0.

Function

minimumConversions(pairs: String[][], source: String, target: String) → int

Examples

Example 1

pairs = [["USD","EUR"],["EUR","JPY"],["USD","GBP"]]source = "USD"target = "JPY"return = 2

The shortest chain is USD to EUR to JPY.

Example 2

pairs = [["A","B"],["C","D"]]source = "A"target = "D"return = -1

The currencies are in disconnected components.

Constraints

  • 0 <= pairs.length <= 10000.
  • Every row contains two nonempty currency codes.
  • Codes contain uppercase English letters.

Source note: Author-written prompt excerpt retained for source fidelity.

More EPAM Phone Screen questions

  • Longest Palindromic SubstringPHONE SCREEN · Seen Oct 2026
  • Container With Most WaterPHONE SCREEN · Seen Oct 2026
  • Convert an Entry List to a MapPHONE SCREEN · Seen Oct 2026
  • Count Array Element FrequenciesPHONE SCREEN · Seen Oct 2026
  • Find First and Last Position of Element in Sorted ArrayPHONE SCREEN · Seen Oct 2026
  • Group AnagramsPHONE SCREEN · Seen Oct 2026
  • Longest Consecutive SequencePHONE SCREEN · Seen Oct 2026
  • Max Consecutive Ones IIIPHONE SCREEN · Seen Oct 2026
  • Next Greater Element IPHONE SCREEN · Seen Oct 2026
  • Partition and Group Values by ParityPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Shortest Pin Path Through TopicsPinterest · PHONE SCREENPinterest interview questions
  • Word Chain Jumps in a GridGoogle · PHONE SCREENGoogle interview questions
  • Currency Conversion RateAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Route Graph Reachability with a Broken LinkFigma · PHONE SCREENFigma interview questions
  • Finite Web CrawlerMongoDB · PHONE SCREEN · ONSITE INTERVIEWMongoDB interview questions
  • Currency Conversion RateBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Clone a Connected GraphAbridge · PHONE SCREENAbridge interview questions
  • Rule References: Validity and EligibilityPlaid · PHONE SCREENPlaid interview questions
  • Find a Directed Resource Access PathCoreWeave · PHONE SCREEN
All EPAM interview questionsSee EPAM hiring insights
Saved
class Solution {
    public int minimumConversions(String[][] pairs, String source, String target) {
        // Write your code here.
    }
}
Checking account…