• Skip to main content
  • Skip to footer

GO ALGORITHMS

Soluciones de lógica con Golang

  • Fácil
  • Intermedio
  • Avanzado
  • Todos
  • GitHub

Dynamic Programming

Climbing Stairs

Easy

Determine the number of distinct ways to climb a staircase of n steps by taking either 1 or 2 steps at a time.

Example:

Input: n = 4
Output: 5

Minimum Coin Combination

Medium

You are given an array of coin values and a target amount of money. Return the minimum number of coins needed to total the target amount. If this isn’t possible, return ‐1. You may assume there’s an unlimited supply of each coin.

Example 1:

Input: coins = [1, 2, 3], target = 5
Output: 2

Explanation: Use one 2-dollar coin and one 3-dollar coin to make 5 dollars.

Example 2:

Input: coins = [2, 4], target = 5
Output: -1

Matrix Pathways

Medium

You are positioned at the top-left corner of a m × n matrix, and can only move downward or rightward through the matrix. Determine the number of unique pathways you can take to reach the bottom-right corner of the matrix.

Example:

Input: m = 3, n = 3
Output: 6

Constraints:

  • m, n ≥ 1

Neighborhood Burglary

Medium

You plan to rob houses in a street where each house stores a certain amount of money. The neighborhood has a security system that sets off an alarm when two adjacent houses are robbed. Return the maximum amount of cash that can be stolen without triggering the alarms.

Example:

Input: houses = [200, 300, 200, 50]
Output: 400

Explanation: Stealing from the houses at indexes 0 and 2 yields 200 + 200 = 400 dollars.

Longest Common Subsequence

Hard

Given two strings, find the length of their longest common subsequence (LCS). A subsequence is a sequence of characters that can be derived from a string by deleting zero or more elements, without changing the order of the remaining elements.

Example:

Input: s1 = 'acabac', s2 = 'aebab'
Output: 3

Longest Palindrome in a String

Medium

Return the longest palindromic substring within a given string.

Example:

Input: s = 'abccbaba'
Output: 'abccba'

Maximum Subarray Sum

Medium

Given an array of integers, return the sum of the subarray with the largest sum.

Example:

Input: nums = [3, 1, -6, 2, -1, 4, -9]
Output: 5

Explanation: subarray [2, -1, 4] has the largest sum of 5.

Constraints:

  • The input array contains at least one element.

0/1 Knapsack

Hard

You are a thief planning to rob a store. However, you can only carry a knapsack with a maximum capacity of cap units. Each item (i) in the store has a weight (weights[i]) and a value (values[i]).

Find the maximum total value of items you can carry in your knapsack.

Example:

Input: cap = 7, weights = [5, 3, 4, 1], values = [70, 50, 40, 10]
Output: 90

Explanation: The most valuable combination of items that can fit in the knapsack together are items 1 and 2 . These items have a combined value of 50 + 40 = 90 and a total weight of 3 + 4 = 7 , which fits within the knapsack’s capacity.

Largest Square in a Matrix

Medium

Determine the area of the largest square of 1’s in a binary matrix.

Example:

Output: 9

Footer

Primeros con algoritmia

Amazon Interview | Asteroid Collision | Data Structures & Algorithms

Algoritmos por dificultad en Go

  • Fácil
  • Intermedio
  • Avanzado
  • Todos
  • GitHub

Algoritmos fáciles con Go

  • Amazon Interview | Asteroid Collision | Data Structures & Algorithms
  • Cifrado César
  • Math And Geometry
  • Bit Manipulation
  • Básicas
  • Más usadas
  • Complejas

Algoritmos intemedios con Go

  • Amazon Interview | Asteroid Collision | Data Structures & Algorithms
  • Cifrado César

Algoritmos avanzados con Go

  • Amazon Interview | Asteroid Collision | Data Structures & Algorithms
  • Cifrado César

Copyright © 2026 · Log in