• Skip to main content
  • Skip to footer

GO ALGORITHMS

Soluciones de lógica con Golang

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

Hash Maps And Sets

Pair Sum – Unsorted

Easy

Given an array of integers, return the indexes of any two numbers that add up to a target. The order of the indexes in the result doesn’t matter. If no pair is found, return an empty array.

Example:

Input: nums = [-1, 3, 4, 2], target = 3
Output: [0, 2]

Explanation: nums[0] + nums[2] = -1 + 4 = 3

Constraints:

  • The same index cannot be used twice in the result.

Verify Sudoku Board

Medium

Given a partially completed 9×9 Sudoku board, determine if the current state of the board adheres to the rules of the game:

  • Each row and column must contain unique numbers between 1 and 9, or be empty (represented as 0).
  • Each of the nine 3×3 subgrids that compose the grid must contain unique numbers between 1 and 9, or be empty.

Note: You are asked to determine whether the current state of the board is valid given these rules, not whether the board is solvable.

Example:

Output: False

Constraints:

  • Assume each integer on the board falls in the range of [0, 9].

Zero Striping

Medium

For each zero in an m x n matrix, set its entire row and column to zero in place.

Longest Chain of Consecutive Numbers

Medium

Find the longest chain of consecutive numbers in an*array. Two numbers are consecutive if they have a difference of 1.

Example:

Input: nums = [1, 6, 2, 5, 8, 7, 10, 3]
Output: 4

Explanation: The longest chain of consecutive numbers is 5, 6, 7, 8.

Geometric Sequence Triplets

Medium

A geometric sequence triplet is a sequence of three numbers where each successive number is obtained by multiplying the preceding number by a constant called the common ratio.

Let’s examine three triplets to understand how this works:

  • (1, 2, 4): This is a geometric sequence with a ratio of 2 (i.e., [1, 1⋅2 = 2, 2⋅2 = 4]).
  • (5, 15, 45): This is a geometric sequence with a ratio of 3 (i.e., [5, 5⋅3 = 15, 15⋅3 = 45]).
  • (2, 3, 4): Not a geometric sequence.

Given an array of integers and a common ratio r, find all triplets of indexes (i, j, k) that follow a geometric sequence for i < j < k. It’s possible to encounter duplicate triplets in the array.

Example:

Input: nums = [2, 1, 2, 4, 8, 8], r = 2
Output: 5

Explanation:

  • Triplet [2, 4, 8] occurs at indexes (0, 3, 4), (0, 3, 5), (2, 3, 4), (2, 3, 5).
  • Triplet [1, 2, 4] occurs at indexes (1, 2, 3).

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