LeetLegendsMaster Coding Using League of Legends!

Summoner's Guide to Coding Interviews

Learning coding doesn't have to be a grind. What if you could trick your brain into learning algorithms and data structures by leveraging the League mechanics you're already familiar with?

I'll show you how to unlock your coding potential using concepts from the Rift to make problem-solving feel as easy as hitting your power spike!

NEW: Get Early Access!

If this sounds like a great fit for you, sign up now and I'll let you know once we're live. I'm building this for Summoners like you who want to learn coding faster and have fun while doing it.

LoL Coding Challenge:

Maximize Your Comeback Power Spike

You've been behind the entire game, struggling to keep up with the enemy team. But with a combination of skill and luck, your team just managed to secure two big shutdowns and take down a tier 2 tower, giving you a sudden influx of gold. It's your chance to turn the game around and mount a comeback!

However, there's a major problem: the enemy team just destroyed your Nexus turret, and the next team fight could decide the game. You don't have time to farm more gold or recall again — you need to power spike right now to have any chance of winning the next fight.

Goal:

Spend your gold perfectly and get the best item power spike you can. You need to find two items whose combined cost exactly matches your available gold. If no such pair exists, buy the single most expensive item you can afford without exceeding your budget.

Game Mechanics:

  • You have a list of available items, each with a fixed gold cost.
  • You know your total gold (the sum from the shutdowns and tower).
  • You want to maximize the amount of gold spent to get the strongest item combination for the upcoming fight.
  • If there is no combination that exactly matches your available gold, your only option is to buy a single item (no wasted gold) — otherwise, return None.

Challenge:

Implement a function findOptimalItems(itemCosts, availableGold): [number, number] that takes an array of item costs and the available gold, and returns either:

  • A tuple of two item costs that sum up to the available gold
  • A single item cost if no combination of two items is possible
  • null if no solution is found

Example:

Available Gold: 3300

Item Costs: [1050,1500,2200,600,500,2800,1000]

Optimal Combination:

  • Item 1: 1500 gold
  • Item 2: 1800 gold (this adds up to 3300).